Profile Status
Count
Passed: 213 (605 individual checks passed)
Failed: 0 (0 individual checks passed, 0 failed out of 0 total checks)
Not Applicable: 24
Not Reviewed: 9
Profile Error: 1
Total: 247
Severity
None: 24
Low: 14
Medium: 185
High: 24
Critical: 0
Compliance
95.51%
[Passed/(Passed + Failed + Not Reviewed + Profile Error) * 100]
Profile Info
Filename: red_hat_good.json
Tool Version: 4.18.104
Platform: redhat
Duration: 32.419937825
ID
Status
Severity
800-53 Controls & CCIs
Title
Unauthorized changes to the baseline configuration could make the system vulnerable to various attacks or allow unauthorized access to the operating system. Changes to operating system configurations can have unintended side effects, some of which may be relevant to security. Detecting such changes and providing an automated response can help avoid unintended, negative consequences that could ultimately affect the security state of the operating system. The operating system's Information Management Officer (IMO)/Information System Security Officer (ISSO) and System Administrators (SAs) must be notified via email and/or monitoring system trap when there is an unauthorized modification of a configuration item.
Test Results

Status passed
Test System Package aide is expected to be installed
Result
Status passed
Test File /etc/cron.daily/aide is expected to exist
Result
Result Details

Control V-71973
Title The Red Hat Enterprise Linux operating system must be configured so that a file integrity tool verifies the baseline operating system configuration at least weekly.
Desc Unauthorized changes to the baseline configuration could make the system vulnerable to various attacks or allow unauthorized access to the operating system. Changes to operating system configurations can have unintended side effects, some of which may be relevant to security. Detecting such changes and providing an automated response can help avoid unintended, negative consequences that could ultimately affect the security state of the operating system. The operating system's Information Management Officer (IMO)/Information System Security Officer (ISSO) and System Administrators (SAs) must be notified via email and/or monitoring system trap when there is an unauthorized modification of a configuration item.
Severity medium
Impact 0.5
Nist Controls CM-3 (5), Rev_4
Check Text Verify the operating system routinely checks the baseline configuration for unauthorized changes. Note: A file integrity tool other than Advanced Intrusion Detection Environment (AIDE) may be used, but the tool must be executed at least once per week. Check to see if AIDE is installed on the system with the following command: # yum list installed aide If AIDE is not installed, ask the SA how file integrity checks are performed on the system. Check for the presence of a cron job running daily or weekly on the system that executes AIDE daily to scan for changes to the system baseline. The command used in the example will use a daily occurrence. Check the cron directories for a script file controlling the execution of the file integrity application. For example, if AIDE is installed on the system, use the following command: # ls -al /etc/cron.* | grep aide -rwxr-xr-x 1 root root 29 Nov 22 2015 aide # grep aide /etc/crontab /var/spool/cron/root /etc/crontab: 30 04 * * * /root/aide /var/spool/cron/root: 30 04 * * * /root/aide If the file integrity application does not exist, or a script file controlling the execution of the file integrity application does not exist, this is a finding.
Fix Text Configure the file integrity tool to run automatically on the system at least weekly. The following example output is generic. It will set cron to run AIDE daily, but other file integrity tools may be used: # more /etc/cron.daily/aide #!/bin/bash /usr/sbin/aide --check | /bin/mail -s "$HOSTNAME - Daily aide integrity check run" root@sysname.mil

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71973" do title "The Red Hat Enterprise Linux operating system must be configured so that a file integrity tool verifies the baseline operating system configuration at least weekly." desc "Unauthorized changes to the baseline configuration could make the system vulnerable to various attacks or allow unauthorized access to the operating system. Changes to operating system configurations can have unintended side effects, some of which may be relevant to security. Detecting such changes and providing an automated response can help avoid unintended, negative consequences that could ultimately affect the security state of the operating system. The operating system's Information Management Officer (IMO)/Information System Security Officer (ISSO) and System Administrators (SAs) must be notified via email and/or monitoring system trap when there is an unauthorized modification of a configuration item. " desc "rationale", "" desc "check", " Verify the operating system routinely checks the baseline configuration for unauthorized changes. Note: A file integrity tool other than Advanced Intrusion Detection Environment (AIDE) may be used, but the tool must be executed at least once per week. Check to see if AIDE is installed on the system with the following command: # yum list installed aide If AIDE is not installed, ask the SA how file integrity checks are performed on the system. Check for the presence of a cron job running daily or weekly on the system that executes AIDE daily to scan for changes to the system baseline. The command used in the example will use a daily occurrence. Check the cron directories for a script file controlling the execution of the file integrity application. For example, if AIDE is installed on the system, use the following command: # ls -al /etc/cron.* | grep aide -rwxr-xr-x 1 root root 29 Nov 22 2015 aide # grep aide /etc/crontab /var/spool/cron/root /etc/crontab: 30 04 * * * /root/aide /var/spool/cron/root: 30 04 * * * /root/aide If the file integrity application does not exist, or a script file controlling the execution of the file integrity application does not exist, this is a finding. " desc "fix", " Configure the file integrity tool to run automatically on the system at least weekly. The following example output is generic. It will set cron to run AIDE daily, but other file integrity tools may be used: # more /etc/cron.daily/aide #!/bin/bash /usr/sbin/aide --check | /bin/mail -s \"$HOSTNAME - Daily aide integrity check run\" root@sysname.mil " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000363-GPOS-00150" tag gid: "V-71973" tag rid: "SV-86597r2_rule" tag stig_id: "RHEL-07-020030" tag fix_id: "F-78325r2_fix" tag cci: ["CCI-001744"] tag nist: ["CM-3 (5)", "Rev_4"] file_integrity_tool = input('file_integrity_tool') file_integrity_interval = input('file_integrity_interval') describe package(file_integrity_tool) do it { should be_installed } end if file_integrity_interval == 'monthly' describe.one do describe file("/etc/cron.daily/#{file_integrity_tool}") do it { should exist } end describe file("/etc/cron.weekly/#{file_integrity_tool}") do it { should exist } end describe file("/etc/cron.monthly/#{file_integrity_tool}") do it { should exist } end if file("/etc/cron.d/#{file_integrity_tool}").exist? describe crontab(path: "/etc/cron.d/#{file_integrity_tool}") do its('months') { should cmp '*' } its('weekdays') { should cmp '*' } end describe crontab(path: "/etc/cron.d/#{file_integrity_tool}") do its('days') { should cmp '*' } its('months') { should cmp '*' } end end describe crontab('root').where { command =~ %r{#{file_integrity_tool}} } do its('months') { should cmp '*' } its('weekdays') { should cmp '*' } end describe crontab('root').where { command =~ %r{#{file_integrity_tool}} } do its('days') { should cmp '*' } its('months') { should cmp '*' } end end elsif file_integrity_interval == 'weekly' describe.one do describe file("/etc/cron.daily/#{file_integrity_tool}") do it { should exist } end describe file("/etc/cron.weekly/#{file_integrity_tool}") do it { should exist } end if file("/etc/cron.d/#{file_integrity_tool}").exist? describe crontab(path: "/etc/cron.d/#{file_integrity_tool}") do its('days') { should cmp '*' } its('months') { should cmp '*' } end end describe crontab('root').where { command =~ %r{#{file_integrity_tool}} } do its('days') { should cmp '*' } its('months') { should cmp '*' } end end elsif file_integrity_interval == 'daily' describe.one do describe file("/etc/cron.daily/#{file_integrity_tool}") do it { should exist } end if file("/etc/cron.d/#{file_integrity_tool}").exist? describe crontab(path: "/etc/cron.d/#{file_integrity_tool}") do its('days') { should cmp '*' } its('months') { should cmp '*' } its('weekdays') { should cmp '*' } end end describe crontab('root').where { command =~ %r{#{file_integrity_tool}} } do its('days') { should cmp '*' } its('months') { should cmp '*' } its('weekdays') { should cmp '*' } end end end end
Information stored in one location is vulnerable to accidental or incidental deletion or alteration. Off-loading is a common process in information systems with limited audit storage capacity. Without the configuration of the "au-remote" plugin, the audisp-remote daemon will not off load the logs from the system being audited.
Test Results

Status skipped
Test File '/etc/audisp/plugins.d/au-remote.conf' cannot be found. This test cannot be checked in a automated fashion and you must check it manually
Result
Result Details

Control V-81017
Title The Red Hat Enterprise Linux operating system must configure the au-remote plugin to off-load audit logs using the audisp-remote daemon.
Desc Information stored in one location is vulnerable to accidental or incidental deletion or alteration. Off-loading is a common process in information systems with limited audit storage capacity. Without the configuration of the "au-remote" plugin, the audisp-remote daemon will not off load the logs from the system being audited.
Severity medium
Impact 0.5
Nist Controls AU-4 (1), Rev_4
Check Text Verify the "au-remote" plugin is configured to always off-load audit logs using the audisp-remote daemon: # cat /etc/audisp/plugins.d/au-remote.conf | grep -v "^#" active = yes direction = out path = /sbin/audisp-remote type = always format = string If the "direction" setting is not set to "out", or the line is commented out, this is a finding. If the "path" setting is not set to "/sbin/audisp-remote", or the line is commented out, this is a finding. If the "type" setting is not set to "always", or the line is commented out, this is a finding.
Fix Text Edit the /etc/audisp/plugins.d/au-remote.conf file and add or update the following values: direction = out path = /sbin/audisp-remote type = always The audit daemon must be restarted for changes to take effect: # service auditd restart

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-81017" do title "The Red Hat Enterprise Linux operating system must configure the au-remote plugin to off-load audit logs using the audisp-remote daemon." desc "Information stored in one location is vulnerable to accidental or incidental deletion or alteration. Off-loading is a common process in information systems with limited audit storage capacity. Without the configuration of the \"au-remote\" plugin, the audisp-remote daemon will not off load the logs from the system being audited. " desc "rationale", "" desc "check", " Verify the \"au-remote\" plugin is configured to always off-load audit logs using the audisp-remote daemon: # cat /etc/audisp/plugins.d/au-remote.conf | grep -v \"^#\" active = yes direction = out path = /sbin/audisp-remote type = always format = string If the \"direction\" setting is not set to \"out\", or the line is commented out, this is a finding. If the \"path\" setting is not set to \"/sbin/audisp-remote\", or the line is commented out, this is a finding. If the \"type\" setting is not set to \"always\", or the line is commented out, this is a finding. " desc "fix", " Edit the /etc/audisp/plugins.d/au-remote.conf file and add or update the following values: direction = out path = /sbin/audisp-remote type = always The audit daemon must be restarted for changes to take effect: # service auditd restart " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000342-GPOS-00133" tag satisfies: ["SRG-OS-000342-GPOS-00133", "SRG-OS-000479-GPOS-00224"] tag gid: "V-81017" tag rid: "SV-95729r1_rule" tag stig_id: "RHEL-07-030201" tag fix_id: "F-87851r2_fix" tag cci: ["CCI-001851"] tag nist: ["AU-4 (1)", "Rev_4"] test_file = '/etc/audisp/plugins.d/au-remote.conf' if file(test_file).exist? describe parse_config_file(test_file) do its('direction') { should match %r{out$} } its('path') { should match %r{/sbin/audisp-remote$} } its('type') { should match %r{always$} } end else describe "File '#{test_file}' cannot be found. This test cannot be checked in a automated fashion and you must check it manually" do skip "File '#{test_file}' cannot be found. This check must be performed manually" end end end
If the system does not require valid root authentication before it boots into single-user or maintenance mode, anyone who invokes single-user or maintenance mode is granted privileged access to all files on the system. GRUB 2 is the default boot loader for RHEL 7 and is designed to require a password to boot into single-user mode or make modifications to the boot menu.
Test Results

Status skipped
Test Parse Config File /boot/grub2/user.cfg
Result
Status passed
Test Parse Config File /boot/grub2/grub.cfg set superusers is expected to cmp == "\"root\""
Result
Result Details

Control V-81005
Title Red Hat Enterprise Linux operating systems version 7.2 or newer with a Basic Input/Output System (BIOS) must require authentication upon booting into single-user and maintenance modes.
Desc If the system does not require valid root authentication before it boots into single-user or maintenance mode, anyone who invokes single-user or maintenance mode is granted privileged access to all files on the system. GRUB 2 is the default boot loader for RHEL 7 and is designed to require a password to boot into single-user mode or make modifications to the boot menu.
Severity high
Impact 0.7
Nist Controls AC-3, Rev_4
Check Text For systems that use UEFI, this is Not Applicable. For systems that are running a version of RHEL prior to 7.2, this is Not Applicable. Check to see if an encrypted root password is set. On systems that use a BIOS, use the following command: # grep -iw grub2_password /boot/grub2/user.cfg GRUB2_PASSWORD=grub.pbkdf2.sha512.[password_hash] If the root password does not begin with "grub.pbkdf2.sha512", this is a finding. Verify that the "root" account is set as the "superusers": # grep -iw "superusers" /boot/grub2/grub.cfg set superusers="root" export superusers If "superusers" is not set to "root", this is a finding.
Fix Text Configure the system to encrypt the boot password for root. Generate an encrypted grub2 password for root with the following command: Note: The hash generated is an example. # grub2-setpassword Enter password: Confirm password: Edit the /boot/grub2/grub.cfg file and add or modify the following lines in the "### BEGIN /etc/grub.d/01_users ###" section: set superusers="root" export superusers

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-81005" do title "Red Hat Enterprise Linux operating systems version 7.2 or newer with a Basic Input/Output System (BIOS) must require authentication upon booting into single-user and maintenance modes." desc "If the system does not require valid root authentication before it boots into single-user or maintenance mode, anyone who invokes single-user or maintenance mode is granted privileged access to all files on the system. GRUB 2 is the default boot loader for RHEL 7 and is designed to require a password to boot into single-user mode or make modifications to the boot menu." desc "rationale", "" desc "check", " For systems that use UEFI, this is Not Applicable. For systems that are running a version of RHEL prior to 7.2, this is Not Applicable. Check to see if an encrypted root password is set. On systems that use a BIOS, use the following command: # grep -iw grub2_password /boot/grub2/user.cfg GRUB2_PASSWORD=grub.pbkdf2.sha512.[password_hash] If the root password does not begin with \"grub.pbkdf2.sha512\", this is a finding. Verify that the \"root\" account is set as the \"superusers\": # grep -iw \"superusers\" /boot/grub2/grub.cfg set superusers=\"root\" export superusers If \"superusers\" is not set to \"root\", this is a finding. " desc "fix", " Configure the system to encrypt the boot password for root. Generate an encrypted grub2 password for root with the following command: Note: The hash generated is an example. # grub2-setpassword Enter password: Confirm password: Edit the /boot/grub2/grub.cfg file and add or modify the following lines in the \"### BEGIN /etc/grub.d/01_users ###\" section: set superusers=\"root\" export superusers " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000080-GPOS-00048" tag gid: "V-81005" tag rid: "SV-95717r1_rule" tag stig_id: "RHEL-07-010482" tag fix_id: "F-87839r2_fix" tag cci: ["CCI-000213"] tag nist: ["AC-3", "Rev_4"] if file('/sys/firmware/efi').exist? impact 0.0 describe "System running UEFI" do skip "The System is running UEFI, this control is Not Applicable." end else unless os[:release] >= "7.2" impact 0.0 describe "System running version of RHEL prior to 7.2" do skip "The System is running an outdated version of RHEL, this control is Not Applicable." end else impact 0.7 input('grub_user_boot_files').each do |grub_user_file| describe parse_config_file(grub_user_file) do its('GRUB2_PASSWORD') { should include "grub.pbkdf2.sha512"} end end describe parse_config_file(input('grub_main_cfg')) do its('set superusers') { should cmp '"root"' } end end end end
Failure to restrict system access to authenticated users negatively impacts operating system security.
Test Results

Status passed
Test SSHD Configuration PermitUserEnvironment is expected to eq "no"
Result
Result Details

Control V-71957
Title The Red Hat Enterprise Linux operating system must not allow users to override SSH environment variables.
Desc Failure to restrict system access to authenticated users negatively impacts operating system security.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the operating system does not allow users to override environment variables to the SSH daemon. Check for the value of the "PermitUserEnvironment" keyword with the following command: # grep -i permituserenvironment /etc/ssh/sshd_config PermitUserEnvironment no If the "PermitUserEnvironment" keyword is not set to "no", is missing, or is commented out, this is a finding.
Fix Text Configure the operating system to not allow users to override environment variables to the SSH daemon. Edit the "/etc/ssh/sshd_config" file to uncomment or add the line for "PermitUserEnvironment" keyword and set the value to "no": PermitUserEnvironment no The SSH service must be restarted for changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71957" do title "The Red Hat Enterprise Linux operating system must not allow users to override SSH environment variables." desc "Failure to restrict system access to authenticated users negatively impacts operating system security." desc "rationale", "" desc "check", " Verify the operating system does not allow users to override environment variables to the SSH daemon. Check for the value of the \"PermitUserEnvironment\" keyword with the following command: # grep -i permituserenvironment /etc/ssh/sshd_config PermitUserEnvironment no If the \"PermitUserEnvironment\" keyword is not set to \"no\", is missing, or is commented out, this is a finding. " desc "fix", " Configure the operating system to not allow users to override environment variables to the SSH daemon. Edit the \"/etc/ssh/sshd_config\" file to uncomment or add the line for \"PermitUserEnvironment\" keyword and set the value to \"no\": PermitUserEnvironment no The SSH service must be restarted for changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00229" tag gid: "V-71957" tag rid: "SV-86581r3_rule" tag stig_id: "RHEL-07-010460" tag fix_id: "F-78309r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe sshd_config do its('PermitUserEnvironment') { should eq 'no' } end end
If the system does not require valid root authentication before it boots into single-user or maintenance mode, anyone who invokes single-user or maintenance mode is granted privileged access to all files on the system.
Test Results

Status passed
Test Command: `grep -i execstart /usr/lib/systemd/system/rescue.service` stdout.strip is expected to match /\/usr\/sbin\/sulogin/
Result
Result Details

Control V-77823
Title The Red Hat Enterprise Linux operating system must require authentication upon booting into single-user and maintenance modes.
Desc If the system does not require valid root authentication before it boots into single-user or maintenance mode, anyone who invokes single-user or maintenance mode is granted privileged access to all files on the system.
Severity medium
Impact 0.5
Nist Controls AC-3, Rev_4
Check Text Verify the operating system must require authentication upon booting into single-user and maintenance modes. Check that the operating system requires authentication upon booting into single-user mode with the following command: # grep -i execstart /usr/lib/systemd/system/rescue.service | grep -i sulogin ExecStart=-/bin/sh -c "/usr/sbin/sulogin; /usr/bin/systemctl --fail --no-block default" If "ExecStart" does not have "/usr/sbin/sulogin" as an option, this is a finding.
Fix Text Configure the operating system to require authentication upon booting into single-user and maintenance modes. Add or modify the "ExecStart" line in "/usr/lib/systemd/system/rescue.service" to include "/usr/sbin/sulogin": ExecStart=-/bin/sh -c "/usr/sbin/sulogin; /usr/bin/systemctl --fail --no-block default"

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-77823" do title "The Red Hat Enterprise Linux operating system must require authentication upon booting into single-user and maintenance modes." desc "If the system does not require valid root authentication before it boots into single-user or maintenance mode, anyone who invokes single-user or maintenance mode is granted privileged access to all files on the system." desc "rationale", "" desc "check", " Verify the operating system must require authentication upon booting into single-user and maintenance modes. Check that the operating system requires authentication upon booting into single-user mode with the following command: # grep -i execstart /usr/lib/systemd/system/rescue.service | grep -i sulogin ExecStart=-/bin/sh -c \"/usr/sbin/sulogin; /usr/bin/systemctl --fail --no-block default\" If \"ExecStart\" does not have \"/usr/sbin/sulogin\" as an option, this is a finding. " desc "fix", " Configure the operating system to require authentication upon booting into single-user and maintenance modes. Add or modify the \"ExecStart\" line in \"/usr/lib/systemd/system/rescue.service\" to include \"/usr/sbin/sulogin\": ExecStart=-/bin/sh -c \"/usr/sbin/sulogin; /usr/bin/systemctl --fail --no-block default\" " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000080-GPOS-00048" tag gid: "V-77823" tag rid: "SV-92519r2_rule" tag stig_id: "RHEL-07-010481" tag fix_id: "F-84523r2_fix" tag cci: ["CCI-000213"] tag nist: ["AC-3", "Rev_4"] describe command("grep -i execstart /usr/lib/systemd/system/rescue.service") do its('stdout.strip') { should match %r{/usr/sbin/sulogin} } end end
Configuring this setting for the SSH daemon provides additional assurance that remote logon via SSH will require a password, even in the event of misconfiguration elsewhere.
Test Results

Status passed
Test SSHD Configuration IgnoreRhosts is expected to cmp == "yes"
Result
Result Details

Control V-72243
Title The Red Hat Enterprise Linux operating system must be configured so that the SSH daemon does not allow authentication using rhosts authentication.
Desc Configuring this setting for the SSH daemon provides additional assurance that remote logon via SSH will require a password, even in the event of misconfiguration elsewhere.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the SSH daemon does not allow authentication using known hosts authentication. To determine how the SSH daemon's "IgnoreRhosts" option is set, run the following command: # grep -i IgnoreRhosts /etc/ssh/sshd_config IgnoreRhosts yes If the value is returned as "no", the returned line is commented out, or no output is returned, this is a finding.
Fix Text Configure the SSH daemon to not allow authentication using known hosts authentication. Add the following line in "/etc/ssh/sshd_config", or uncomment the line and set the value to "yes": IgnoreRhosts yes

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72243" do title "The Red Hat Enterprise Linux operating system must be configured so that the SSH daemon does not allow authentication using rhosts authentication." desc "Configuring this setting for the SSH daemon provides additional assurance that remote logon via SSH will require a password, even in the event of misconfiguration elsewhere." desc "rationale", "" desc "check", " Verify the SSH daemon does not allow authentication using known hosts authentication. To determine how the SSH daemon's \"IgnoreRhosts\" option is set, run the following command: # grep -i IgnoreRhosts /etc/ssh/sshd_config IgnoreRhosts yes If the value is returned as \"no\", the returned line is commented out, or no output is returned, this is a finding. " desc "fix", " Configure the SSH daemon to not allow authentication using known hosts authentication. Add the following line in \"/etc/ssh/sshd_config\", or uncomment the line and set the value to \"yes\": IgnoreRhosts yes " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72243" tag rid: "SV-86867r3_rule" tag stig_id: "RHEL-07-040350" tag fix_id: "F-78597r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe sshd_config do its('IgnoreRhosts') { should cmp 'yes' } end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with syscall == "finit_module" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "finit_module" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "finit_module" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "finit_module" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Result Details

Control V-79001
Title The Red Hat Enterprise Linux operating system must audit all uses of the finit_module syscall.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-12 c, Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "finit_module" syscall occur. Check the auditing rules in "/etc/audit/audit.rules" with the following command: # grep -iw finit_module /etc/audit/audit.rules -a always,exit -F arch=b32 -S finit_module -k module-change -a always,exit -F arch=b64 -S finit_module -k module-change If both the "b32" and "b64" audit rules are not defined for the "finit_module" syscall, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "finit_module" syscall occur. Add or update the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S finit_module -k module-change -a always,exit -F arch=b64 -S finit_module -k module-change The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-79001" do title "The Red Hat Enterprise Linux operating system must audit all uses of the finit_module syscall." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"finit_module\" syscall occur. Check the auditing rules in \"/etc/audit/audit.rules\" with the following command: # grep -iw finit_module /etc/audit/audit.rules -a always,exit -F arch=b32 -S finit_module -k module-change -a always,exit -F arch=b64 -S finit_module -k module-change If both the \"b32\" and \"b64\" audit rules are not defined for the \"finit_module\" syscall, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"finit_module\" syscall occur. Add or update the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S finit_module -k module-change -a always,exit -F arch=b64 -S finit_module -k module-change The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000471-GPOS-00216" tag satisfies: ["SRG-OS-000471-GPOS-00216", "SRG-OS-000477-GPOS-00222"] tag gid: "V-79001" tag rid: "SV-93707r3_rule" tag stig_id: "RHEL-07-030821" tag fix_id: "F-85751r3_fix" tag cci: ["CCI-000172"] tag nist: ["AU-12 c", "Rev_4"] describe auditd.syscall("finit_module").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end if os.arch == 'x86_64' describe auditd.syscall("finit_module").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end end end
It is detrimental for operating systems to provide, or install by default, functionality exceeding requirements or mission objectives. These unnecessary capabilities or services are often overlooked and therefore may remain unsecured. They increase the risk to the platform by providing additional attack vectors. Operating systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions). The rsh-server service provides an unencrypted remote access service that does not provide for the confidentiality and integrity of user passwords or the remote session and has very weak authentication. If a privileged user were to log on using this service, the privileged user password could be compromised.
Test Results

Status passed
Test System Package rsh-server is expected not to be installed
Result
Result Details

Control V-71967
Title The Red Hat Enterprise Linux operating system must not have the rsh-server package installed.
Desc It is detrimental for operating systems to provide, or install by default, functionality exceeding requirements or mission objectives. These unnecessary capabilities or services are often overlooked and therefore may remain unsecured. They increase the risk to the platform by providing additional attack vectors. Operating systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions). The rsh-server service provides an unencrypted remote access service that does not provide for the confidentiality and integrity of user passwords or the remote session and has very weak authentication. If a privileged user were to log on using this service, the privileged user password could be compromised.
Severity high
Impact 0.7
Nist Controls CM-7 a, Rev_4
Check Text Check to see if the rsh-server package is installed with the following command: # yum list installed rsh-server If the rsh-server package is installed, this is a finding.
Fix Text Configure the operating system to disable non-essential capabilities by removing the rsh-server package from the system with the following command: # yum remove rsh-server

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71967" do title "The Red Hat Enterprise Linux operating system must not have the rsh-server package installed." desc "It is detrimental for operating systems to provide, or install by default, functionality exceeding requirements or mission objectives. These unnecessary capabilities or services are often overlooked and therefore may remain unsecured. They increase the risk to the platform by providing additional attack vectors. Operating systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions). The rsh-server service provides an unencrypted remote access service that does not provide for the confidentiality and integrity of user passwords or the remote session and has very weak authentication. If a privileged user were to log on using this service, the privileged user password could be compromised. " desc "rationale", "" desc "check", " Check to see if the rsh-server package is installed with the following command: # yum list installed rsh-server If the rsh-server package is installed, this is a finding. " desc "fix", " Configure the operating system to disable non-essential capabilities by removing the rsh-server package from the system with the following command: # yum remove rsh-server " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000095-GPOS-00049" tag gid: "V-71967" tag rid: "SV-86591r2_rule" tag stig_id: "RHEL-07-020000" tag fix_id: "F-78319r1_fix" tag cci: ["CCI-000381"] tag nist: ["CM-7 a", "Rev_4"] describe package("rsh-server") do it { should_not be_installed } end end
If TFTP is required for operational support (such as the transmission of router configurations) its use must be documented with the Information System Security Officer (ISSO), restricted to only authorized personnel, and have access control rules established.
Test Results

Status passed
Test System Package tftp-server is expected not to be installed
Result
Result Details

Control V-72301
Title The Red Hat Enterprise Linux operating system must not have the Trivial File Transfer Protocol (TFTP) server package installed if not required for operational support.
Desc If TFTP is required for operational support (such as the transmission of router configurations) its use must be documented with the Information System Security Officer (ISSO), restricted to only authorized personnel, and have access control rules established.
Severity high
Impact 0.7
Nist Controls CM-3 f, CM-6 c, CM-11 (2), CM-5 (1), CM-5 (1), Rev_4
Check Text Verify a TFTP server has not been installed on the system. Check to see if a TFTP server has been installed with the following command: # yum list installed tftp-server tftp-server-0.49-9.el7.x86_64.rpm If TFTP is installed and the requirement for TFTP is not documented with the ISSO, this is a finding.
Fix Text Remove the TFTP package from the system with the following command: # yum remove tftp-server

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72301" do title "The Red Hat Enterprise Linux operating system must not have the Trivial File Transfer Protocol (TFTP) server package installed if not required for operational support." desc "If TFTP is required for operational support (such as the transmission of router configurations) its use must be documented with the Information System Security Officer (ISSO), restricted to only authorized personnel, and have access control rules established." desc "rationale", "" desc "check", " Verify a TFTP server has not been installed on the system. Check to see if a TFTP server has been installed with the following command: # yum list installed tftp-server tftp-server-0.49-9.el7.x86_64.rpm If TFTP is installed and the requirement for TFTP is not documented with the ISSO, this is a finding. " desc "fix", " Remove the TFTP package from the system with the following command: # yum remove tftp-server " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72301" tag rid: "SV-86925r2_rule" tag stig_id: "RHEL-07-040700" tag fix_id: "F-78655r2_fix" tag cci: ["CCI-000318", "CCI-000368", "CCI-001812", "CCI-001813", "CCI-001814"] tag nist: ["CM-3 f", "CM-6 c", "CM-11 (2)", "CM-5 (1)", "CM-5 (1)", "Rev_4"] describe package('tftp-server') do it { should_not be_installed } end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with file == "/var/log/lastlog" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/var/log/lastlog" action is expected not to include "never"
Result
Status passed
Test ["w", "a"] is expected to include "w"
Result
Status passed
Test ["w", "a"] is expected to include "a"
Result
Result Details

Control V-72147
Title The Red Hat Enterprise Linux operating system must generate audit records for all successful account access events.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-2 d, AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful account access events occur. Check the file system rules in "/etc/audit/audit.rules" with the following commands: # grep -i /var/log/lastlog /etc/audit/audit.rules -w /var/log/lastlog -p wa -k logins If the command does not return any output, this is a finding.
Fix Text Configure the operating system to generate audit records when successful account access events occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules": -w /var/log/lastlog -p wa -k logins The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72147" do title "The Red Hat Enterprise Linux operating system must generate audit records for all successful account access events." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful account access events occur. Check the file system rules in \"/etc/audit/audit.rules\" with the following commands: # grep -i /var/log/lastlog /etc/audit/audit.rules -w /var/log/lastlog -p wa -k logins If the command does not return any output, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful account access events occur. Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -w /var/log/lastlog -p wa -k logins The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000392-GPOS-00172" tag satisfies: ["SRG-OS-000392-GPOS-00172", "SRG-OS-000470-GPOS-00214", "SRG-OS-000473-GPOS-00218"] tag gid: "V-72147" tag rid: "SV-86771r3_rule" tag stig_id: "RHEL-07-030620" tag fix_id: "F-78499r3_fix" tag cci: ["CCI-000126", "CCI-000172", "CCI-002884"] tag nist: ["AU-2 d", "AU-12 c", "MA-4 (1) (a)", "Rev_4"] audit_file = '/var/log/lastlog' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'w' } it { should include 'a' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
Passwords need to be protected at all times, and encryption is the standard method for protecting passwords. If passwords are not encrypted, they can be plainly read (i.e., clear text) and easily compromised. Passwords encrypted with a weak algorithm are no more protected than if they are kept in plain text.
Test Results

Status passed
Test login.defs ENCRYPT_METHOD is expected to cmp == "SHA512"
Result
Result Details

Control V-71921
Title The Red Hat Enterprise Linux operating system must be configured to use the shadow file to store only encrypted representations of passwords.
Desc Passwords need to be protected at all times, and encryption is the standard method for protecting passwords. If passwords are not encrypted, they can be plainly read (i.e., clear text) and easily compromised. Passwords encrypted with a weak algorithm are no more protected than if they are kept in plain text.
Severity medium
Impact 0.5
Nist Controls IA-5 (1) (c), Rev_4
Check Text Verify the system's shadow file is configured to store only encrypted representations of passwords. The strength of encryption that must be used to hash passwords for all accounts is SHA512. Check that the system is configured to create SHA512 hashed passwords with the following command: # grep -i encrypt /etc/login.defs ENCRYPT_METHOD SHA512 If the "/etc/login.defs" configuration file does not exist or allows for password hashes other than SHA512 to be used, this is a finding.
Fix Text Configure the operating system to store only SHA512 encrypted representations of passwords. Add or update the following line in "/etc/login.defs": ENCRYPT_METHOD SHA512

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71921" do title "The Red Hat Enterprise Linux operating system must be configured to use the shadow file to store only encrypted representations of passwords." desc "Passwords need to be protected at all times, and encryption is the standard method for protecting passwords. If passwords are not encrypted, they can be plainly read (i.e., clear text) and easily compromised. Passwords encrypted with a weak algorithm are no more protected than if they are kept in plain text." desc "rationale", "" desc "check", " Verify the system's shadow file is configured to store only encrypted representations of passwords. The strength of encryption that must be used to hash passwords for all accounts is SHA512. Check that the system is configured to create SHA512 hashed passwords with the following command: # grep -i encrypt /etc/login.defs ENCRYPT_METHOD SHA512 If the \"/etc/login.defs\" configuration file does not exist or allows for password hashes other than SHA512 to be used, this is a finding. " desc "fix", " Configure the operating system to store only SHA512 encrypted representations of passwords. Add or update the following line in \"/etc/login.defs\": ENCRYPT_METHOD SHA512 " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000073-GPOS-00041" tag gid: "V-71921" tag rid: "SV-86545r2_rule" tag stig_id: "RHEL-07-010210" tag fix_id: "F-78273r1_fix" tag cci: ["CCI-000196"] tag nist: ["IA-5 (1) (c)", "Rev_4"] describe login_defs do its('ENCRYPT_METHOD') { should cmp "SHA512" } end end
If the system is not configured to audit certain activities and write them to an audit log, it is more difficult to detect and track system compromises and damages incurred during a system compromise.
Test Results

Status passed
Test Auditd Rules with syscall == "unlink" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "unlink" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "unlink" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "unlink" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Result Details

Control V-72205
Title The Red Hat Enterprise Linux operating system must audit all uses of the unlink syscall.
Desc If the system is not configured to audit certain activities and write them to an audit log, it is more difficult to detect and track system compromises and damages incurred during a system compromise.
Severity medium
Impact 0.5
Nist Controls AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "unlink" syscall occur. Check the file system rules in "/etc/audit/audit.rules" with the following commands: # grep -iw unlink /etc/audit/audit.rules -a always,exit -F arch=b32 -S unlink -F auid>=1000 -F auid!=4294967295 -k delete -a always,exit -F arch=b64 -S unlink -F auid>=1000 -F auid!=4294967295 -k delete If both the "b32" and "b64" audit rules are not defined for the "unlink" syscall, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "unlink" syscall occur. Add the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S unlink -F auid>=1000 -F auid!=4294967295 -k delete -a always,exit -F arch=b64 -S unlink -F auid>=1000 -F auid!=4294967295 -k delete The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72205" do title "The Red Hat Enterprise Linux operating system must audit all uses of the unlink syscall." desc "If the system is not configured to audit certain activities and write them to an audit log, it is more difficult to detect and track system compromises and damages incurred during a system compromise. " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"unlink\" syscall occur. Check the file system rules in \"/etc/audit/audit.rules\" with the following commands: # grep -iw unlink /etc/audit/audit.rules -a always,exit -F arch=b32 -S unlink -F auid>=1000 -F auid!=4294967295 -k delete -a always,exit -F arch=b64 -S unlink -F auid>=1000 -F auid!=4294967295 -k delete If both the \"b32\" and \"b64\" audit rules are not defined for the \"unlink\" syscall, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"unlink\" syscall occur. Add the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S unlink -F auid>=1000 -F auid!=4294967295 -k delete -a always,exit -F arch=b64 -S unlink -F auid>=1000 -F auid!=4294967295 -k delete The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000466-GPOS-00210" tag satisfies: ["SRG-OS-000466-GPOS-00210", "SRG-OS-000467-GPOS-00210", "SRG-OS-000468-GPOS-00212", "SRG-OS-000392-GPOS-00172"] tag gid: "V-72205" tag rid: "SV-86829r5_rule" tag stig_id: "RHEL-07-030910" tag fix_id: "F-78559r7_fix" tag cci: ["CCI-000172", "CCI-002884"] tag nist: ["AU-12 c", "MA-4 (1) (a)", "Rev_4"] describe auditd.syscall("unlink").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end if os.arch == 'x86_64' describe auditd.syscall("unlink").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with syscall == "setxattr" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "setxattr" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "setxattr" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "setxattr" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Result Details

Control V-72111
Title The Red Hat Enterprise Linux operating system must audit all uses of the setxattr syscall.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-12 c, Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "setxattr" syscall occur. Check the file system rules in "/etc/audit/audit.rules" with the following commands: # grep -iw setxattr /etc/audit/audit.rules -a always,exit -F arch=b32 -S setxattr -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S setxattr -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the "b32" and "b64" audit rules are not defined for the "setxattr" syscall, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "setxattr" syscall occur. Add or update the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S setxattr -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S setxattr -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72111" do title "The Red Hat Enterprise Linux operating system must audit all uses of the setxattr syscall." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"setxattr\" syscall occur. Check the file system rules in \"/etc/audit/audit.rules\" with the following commands: # grep -iw setxattr /etc/audit/audit.rules -a always,exit -F arch=b32 -S setxattr -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S setxattr -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the \"b32\" and \"b64\" audit rules are not defined for the \"setxattr\" syscall, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"setxattr\" syscall occur. Add or update the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S setxattr -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S setxattr -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000458-GPOS-00203" tag satisfies: ["SRG-OS-000458-GPOS-00203", "SRG-OS-000392-GPOS-00172", "SRG-OS-000064-GPOS-00033"] tag gid: "V-72111" tag rid: "SV-86735r5_rule" tag stig_id: "RHEL-07-030440" tag fix_id: "F-78463r8_fix" tag cci: ["CCI-000172"] tag nist: ["AU-12 c", "Rev_4"] describe auditd.syscall("setxattr").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end if os.arch == 'x86_64' describe auditd.syscall("setxattr").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end end end
If the system does not require valid root authentication before it boots into single-user or maintenance mode, anyone who invokes single-user or maintenance mode is granted privileged access to all files on the system. GRUB 2 is the default boot loader for RHEL 7 and is designed to require a password to boot into single-user mode or make modifications to the boot menu.
Test Results

Status passed
Test There must be only one grub2 superuser, and it must have the value root length is expected to cmp == 1
Result
Status passed
Test There must be only one grub2 superuser, and it must have the value root first is expected to cmp == "root"
Result
Status passed
Test The grub2 superuser password entry must begin with 'password_pbkdf2' is expected to include "password_pbkdf2"
Result
Status passed
Test The grub2 superuser password entry must begin with 'password_pbkdf2' length is expected to be >= 1
Result
Status passed
Test The grub2 superuser account password should be encrypted with pbkdf2. is expected to match /password_pbkdf2\sroot\sgrub\.pbkdf2/i
Result
Result Details

Control V-71961
Title Red Hat Enterprise Linux operating systems prior to version 7.2 with a Basic Input/Output System (BIOS) must require authentication upon booting into single-user and maintenance modes.
Desc If the system does not require valid root authentication before it boots into single-user or maintenance mode, anyone who invokes single-user or maintenance mode is granted privileged access to all files on the system. GRUB 2 is the default boot loader for RHEL 7 and is designed to require a password to boot into single-user mode or make modifications to the boot menu.
Severity high
Impact 0.7
Nist Controls AC-3, Rev_4
Check Text For systems that use UEFI, this is Not Applicable. For systems that are running RHEL 7.2 or newer, this is Not Applicable. Check to see if an encrypted root password is set. On systems that use a BIOS, use the following command: # grep -i password_pbkdf2 /boot/grub2/grub.cfg password_pbkdf2 [superusers-account] [password-hash] If the root password entry does not begin with "password_pbkdf2", this is a finding. If the "superusers-account" is not set to "root", this is a finding.
Fix Text Configure the system to encrypt the boot password for root. Generate an encrypted grub2 password for root with the following command: Note: The hash generated is an example. # grub2-mkpasswd-pbkdf2 Enter Password: Reenter Password: PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.F3A7CFAA5A51EED123BE8238C23B25B2A6909AFC9812F0D45 Edit "/etc/grub.d/40_custom" and add the following lines below the comments: # vi /etc/grub.d/40_custom set superusers="root" password_pbkdf2 root {hash from grub2-mkpasswd-pbkdf2 command} Generate a new "grub.conf" file with the new password with the following commands: # grub2-mkconfig --output=/tmp/grub2.cfg # mv /tmp/grub2.cfg /boot/grub2/grub.cfg

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71961" do title "Red Hat Enterprise Linux operating systems prior to version 7.2 with a Basic Input/Output System (BIOS) must require authentication upon booting into single-user and maintenance modes." desc "If the system does not require valid root authentication before it boots into single-user or maintenance mode, anyone who invokes single-user or maintenance mode is granted privileged access to all files on the system. GRUB 2 is the default boot loader for RHEL 7 and is designed to require a password to boot into single-user mode or make modifications to the boot menu." desc "rationale", "" desc "check", " For systems that use UEFI, this is Not Applicable. For systems that are running RHEL 7.2 or newer, this is Not Applicable. Check to see if an encrypted root password is set. On systems that use a BIOS, use the following command: # grep -i password_pbkdf2 /boot/grub2/grub.cfg password_pbkdf2 [superusers-account] [password-hash] If the root password entry does not begin with \"password_pbkdf2\", this is a finding. If the \"superusers-account\" is not set to \"root\", this is a finding. " desc "fix", " Configure the system to encrypt the boot password for root. Generate an encrypted grub2 password for root with the following command: Note: The hash generated is an example. # grub2-mkpasswd-pbkdf2 Enter Password: Reenter Password: PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.F3A7CFAA5A51EED123BE8238C23B25B2A6909AFC9812F0D45 Edit \"/etc/grub.d/40_custom\" and add the following lines below the comments: # vi /etc/grub.d/40_custom set superusers=\"root\" password_pbkdf2 root {hash from grub2-mkpasswd-pbkdf2 command} Generate a new \"grub.conf\" file with the new password with the following commands: # grub2-mkconfig --output=/tmp/grub2.cfg # mv /tmp/grub2.cfg /boot/grub2/grub.cfg " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000080-GPOS-00048" tag gid: "V-71961" tag rid: "SV-86585r6_rule" tag stig_id: "RHEL-07-010480" tag fix_id: "F-78313r3_fix" tag cci: ["CCI-000213"] tag nist: ["AC-3", "Rev_4"] grub_superuser = input('grub_superuser') grub_user_boot_files = input('grub_user_boot_files') grub_main_cfg = input('grub_main_cfg') grub_main_content = file(grub_main_cfg).content # Check if any additional superusers are set pattern = %r{\s*set superusers=\"(\w+)\"}i matches = grub_main_content.match(pattern) superusers = matches.nil? ? [] : matches.captures describe "There must be only one grub2 superuser, and it must have the value #{grub_superuser}" do subject { superusers } its('length') { should cmp 1 } its('first') { should cmp grub_superuser } end # Need each password entry that has the superuser pattern = %r{(.*)\s#{grub_superuser}\s}i matches = grub_main_content.match(pattern) password_entries = matches.nil? ? [] : matches.captures # Each of the entries should start with password_pbkdf2 describe 'The grub2 superuser password entry must begin with \'password_pbkdf2\'' do subject { password_entries } its('length') { is_expected.to be >= 1} password_entries.each do |entry| subject { entry } it { should include 'password_pbkdf2'} end end # Get lines such as 'password_pbkdf2 root ${ENV}' pattern = %r{password_pbkdf2\s#{grub_superuser}\s(\${\w+})}i matches = grub_main_content.match(pattern) env_vars = matches.nil? ? [] : matches.captures if env_vars.length > 0 # If there is an environment variable in the configuration file check that it is set with correct values by looking # in user.cfg files. env_vars = env_vars.map { |env_var| env_var.gsub(/[${}]/, '') } present_user_boot_files = grub_user_boot_files.select { |user_boot_file| file(user_boot_file).exist? } describe 'grub2 user configuration files for the superuser should be present if they set an environment variable' do subject { present_user_boot_files } its('length') { is_expected.to be >= 1 } present_user_boot_files.each do |user_boot_file| env_vars.each do |env_var| describe "#{user_boot_file} should set #{env_var} to a pbkdf2 value" do subject { file(user_boot_file) } its('content') { should match %r{^#{env_var}=grub.pbkdf2}i } end end end end else # If there are no environment variable set, look for pbkdf2 after the superuser name pattern = %r{password_pbkdf2\s#{grub_superuser}\sgrub\.pbkdf2}i describe 'The grub2 superuser account password should be encrypted with pbkdf2.' do subject { grub_main_content } it { should match pattern } end end end
Network interfaces in promiscuous mode allow for the capture of all network traffic visible to the system. If unauthorized individuals can access these applications, it may allow then to collect information such as logon IDs, passwords, and key exchanges between systems. If the system is being used to perform a network troubleshooting function, the use of these tools must be documented with the Information System Security Officer (ISSO) and restricted to only authorized personnel.
Test Results

Status passed
Test Command: `ip link | grep -i promisc` stdout.strip is expected to match /^$/
Result
Result Details

Control V-72295
Title Network interfaces configured on the Red Hat Enterprise Linux operating system must not be in promiscuous mode.
Desc Network interfaces in promiscuous mode allow for the capture of all network traffic visible to the system. If unauthorized individuals can access these applications, it may allow then to collect information such as logon IDs, passwords, and key exchanges between systems. If the system is being used to perform a network troubleshooting function, the use of these tools must be documented with the Information System Security Officer (ISSO) and restricted to only authorized personnel.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify network interfaces are not in promiscuous mode unless approved by the ISSO and documented. Check for the status with the following command: # ip link | grep -i promisc If network interfaces are found on the system in promiscuous mode and their use has not been approved by the ISSO and documented, this is a finding.
Fix Text Configure network interfaces to turn off promiscuous mode unless approved by the ISSO and documented. Set the promiscuous mode of an interface to off with the following command: #ip link set dev <devicename> multicast off promisc off

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72295" do title "Network interfaces configured on the Red Hat Enterprise Linux operating system must not be in promiscuous mode." desc "Network interfaces in promiscuous mode allow for the capture of all network traffic visible to the system. If unauthorized individuals can access these applications, it may allow then to collect information such as logon IDs, passwords, and key exchanges between systems. If the system is being used to perform a network troubleshooting function, the use of these tools must be documented with the Information System Security Officer (ISSO) and restricted to only authorized personnel. " desc "rationale", "" desc "check", " Verify network interfaces are not in promiscuous mode unless approved by the ISSO and documented. Check for the status with the following command: # ip link | grep -i promisc If network interfaces are found on the system in promiscuous mode and their use has not been approved by the ISSO and documented, this is a finding. " desc "fix", " Configure network interfaces to turn off promiscuous mode unless approved by the ISSO and documented. Set the promiscuous mode of an interface to off with the following command: #ip link set dev <devicename> multicast off promisc off " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72295" tag rid: "SV-86919r2_rule" tag stig_id: "RHEL-07-040670" tag fix_id: "F-78649r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe command("ip link | grep -i promisc") do its('stdout.strip') { should match %r{^$} } end end
The "nosuid" mount option causes the system to not execute "setuid" and "setgid" files with owner privileges. This option must be used for mounting any file system not containing approved "setuid" and "setguid" files. Executing files from untrusted file systems increases the opportunity for unprivileged users to attain unauthorized administrative access.
Test Results

Status passed
Test File system "xfs" does not correspond to removable media. is expected to eq true
Result
Result Details

Control V-72043
Title The Red Hat Enterprise Linux operating system must prevent files with the setuid and setgid bit set from being executed on file systems that are used with removable media.
Desc The "nosuid" mount option causes the system to not execute "setuid" and "setgid" files with owner privileges. This option must be used for mounting any file system not containing approved "setuid" and "setguid" files. Executing files from untrusted file systems increases the opportunity for unprivileged users to attain unauthorized administrative access.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify file systems that are used for removable media are mounted with the "nosuid" option. Check the file systems that are mounted at boot time with the following command: # more /etc/fstab UUID=2bc871e4-e2a3-4f29-9ece-3be60c835222 /mnt/usbflash vfat noauto,owner,ro,nosuid 0 0 If a file system found in "/etc/fstab" refers to removable media and it does not have the "nosuid" option set, this is a finding.
Fix Text Configure the "/etc/fstab" to use the "nosuid" option on file systems that are associated with removable media.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72043" do title "The Red Hat Enterprise Linux operating system must prevent files with the setuid and setgid bit set from being executed on file systems that are used with removable media." desc "The \"nosuid\" mount option causes the system to not execute \"setuid\" and \"setgid\" files with owner privileges. This option must be used for mounting any file system not containing approved \"setuid\" and \"setguid\" files. Executing files from untrusted file systems increases the opportunity for unprivileged users to attain unauthorized administrative access." desc "rationale", "" desc "check", " Verify file systems that are used for removable media are mounted with the \"nosuid\" option. Check the file systems that are mounted at boot time with the following command: # more /etc/fstab UUID=2bc871e4-e2a3-4f29-9ece-3be60c835222 /mnt/usbflash vfat noauto,owner,ro,nosuid 0 0 If a file system found in \"/etc/fstab\" refers to removable media and it does not have the \"nosuid\" option set, this is a finding. " desc "fix", "Configure the \"/etc/fstab\" to use the \"nosuid\" option on file systems that are associated with removable media." impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72043" tag rid: "SV-86667r2_rule" tag stig_id: "RHEL-07-021010" tag fix_id: "F-78395r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] non_removable_media_fs = input('non_removable_media_fs') file_systems = etc_fstab.params if !file_systems.nil? and !file_systems.empty? file_systems.each do |file_sys_line| if !"#{non_removable_media_fs}".include?(file_sys_line['file_system_type']) then describe file_sys_line['mount_options'] do it { should include 'nosuid' } end else describe "File system \"#{file_sys_line['file_system_type']}\" does not correspond to removable media." do subject { "#{non_removable_media_fs}".include?(file_sys_line['file_system_type']) } it { should eq true } end end end else describe "No file systems were found." do subject { file_systems.nil? } it { should eq true } end end end
It is critical for the appropriate personnel to be aware if a system is at risk of failing to process audit logs as required. Without this notification, the security personnel may be unaware of an impending failure of the audit capability, and system operation may be adversely affected. Audit processing failures include software/hardware errors, failures in the audit capturing mechanisms, and audit storage capacity being reached or exceeded. This requirement applies to each audit data storage repository (i.e., distinct information system component where audit records are stored), the centralized audit storage capacity of organizations (i.e., all audit data storage repositories combined), or both.
Test Results

Status passed
Test 2 is expected to match /^(1|2)$/
Result
Result Details

Control V-72081
Title The Red Hat Enterprise Linux operating system must shut down upon audit processing failure, unless availability is an overriding concern. If availability is a concern, the system must alert the designated staff (System Administrator [SA] and Information System Security Officer [ISSO] at a minimum) in the event of an audit processing failure.
Desc It is critical for the appropriate personnel to be aware if a system is at risk of failing to process audit logs as required. Without this notification, the security personnel may be unaware of an impending failure of the audit capability, and system operation may be adversely affected. Audit processing failures include software/hardware errors, failures in the audit capturing mechanisms, and audit storage capacity being reached or exceeded. This requirement applies to each audit data storage repository (i.e., distinct information system component where audit records are stored), the centralized audit storage capacity of organizations (i.e., all audit data storage repositories combined), or both.
Severity medium
Impact 0.5
Nist Controls AU-5 a, Rev_4
Check Text Confirm the audit configuration regarding how auditing processing failures are handled. Check to see what level "auditctl" is set to with following command: # auditctl -s | grep -i "fail" failure 2 If the value of "failure" is set to "2", the system is configured to panic (shut down) in the event of an auditing failure. If the value of "failure" is set to "1", the system is configured to only send information to the kernel log regarding the failure. If the "failure" setting is not set, this is a CAT I finding. If the "failure" setting is set to any value other than "1" or "2", this is a CAT II finding. If the "failure" setting is set to "1" but the availability concern is not documented or there is no monitoring of the kernel log, this is a CAT III finding.
Fix Text Configure the operating system to shut down in the event of an audit processing failure. Add or correct the option to shut down the operating system with the following command: # auditctl -f 2 Edit the "/etc/audit/rules.d/audit.rules" file and add the following line: -f 2 If availability has been determined to be more important, and this decision is documented with the ISSO, configure the operating system to notify system administration staff and ISSO staff in the event of an audit processing failure with the following command: # auditctl -f 1 Edit the "/etc/audit/rules.d/audit.rules" file and add the following line: -f 1 Kernel log monitoring must also be configured to properly alert designated staff. The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72081" do title "The Red Hat Enterprise Linux operating system must shut down upon audit processing failure, unless availability is an overriding concern. If availability is a concern, the system must alert the designated staff (System Administrator [SA] and Information System Security Officer [ISSO] at a minimum) in the event of an audit processing failure." desc "It is critical for the appropriate personnel to be aware if a system is at risk of failing to process audit logs as required. Without this notification, the security personnel may be unaware of an impending failure of the audit capability, and system operation may be adversely affected. Audit processing failures include software/hardware errors, failures in the audit capturing mechanisms, and audit storage capacity being reached or exceeded. This requirement applies to each audit data storage repository (i.e., distinct information system component where audit records are stored), the centralized audit storage capacity of organizations (i.e., all audit data storage repositories combined), or both. " desc "rationale", "" desc "check", " Confirm the audit configuration regarding how auditing processing failures are handled. Check to see what level \"auditctl\" is set to with following command: # auditctl -s | grep -i \"fail\" failure 2 If the value of \"failure\" is set to \"2\", the system is configured to panic (shut down) in the event of an auditing failure. If the value of \"failure\" is set to \"1\", the system is configured to only send information to the kernel log regarding the failure. If the \"failure\" setting is not set, this is a CAT I finding. If the \"failure\" setting is set to any value other than \"1\" or \"2\", this is a CAT II finding. If the \"failure\" setting is set to \"1\" but the availability concern is not documented or there is no monitoring of the kernel log, this is a CAT III finding. " desc "fix", " Configure the operating system to shut down in the event of an audit processing failure. Add or correct the option to shut down the operating system with the following command: # auditctl -f 2 Edit the \"/etc/audit/rules.d/audit.rules\" file and add the following line: -f 2 If availability has been determined to be more important, and this decision is documented with the ISSO, configure the operating system to notify system administration staff and ISSO staff in the event of an audit processing failure with the following command: # auditctl -f 1 Edit the \"/etc/audit/rules.d/audit.rules\" file and add the following line: -f 1 Kernel log monitoring must also be configured to properly alert designated staff. The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000046-GPOS-00022" tag satisfies: ["SRG-OS-000046-GPOS-00022", "SRG-OS-000047-GPOS-00023"] tag gid: "V-72081" tag rid: "SV-86705r4_rule" tag stig_id: "RHEL-07-030010" tag fix_id: "F-78433r2_fix" tag cci: ["CCI-000139"] tag nist: ["AU-5 a", "Rev_4"] monitor_kernel_log = input('monitor_kernel_log') if auditd.status['failure'].nil? impact 0.7 elsif auditd.status['failure'].match?(%r{^1$}) && !monitor_kernel_log impact 0.3 else impact 0.5 end if !monitor_kernel_log describe auditd.status['failure'] do it { should match %r{^2$} } end else describe auditd.status['failure'] do it { should match %r{^(1|2)$} } end end end
The .shosts files are used to configure host-based authentication for individual users or the system via SSH. Host-based authentication is not sufficient for preventing unauthorized access to the system, as it does not require interactive identification and authentication of a connection request, or for the use of two-factor authentication.
Test Results

Status passed
Test Command: `find / -xautofs -name '*.shosts'` stdout.strip is expected to be empty
Result
Result Details

Control V-72277
Title The Red Hat Enterprise Linux operating system must not contain .shosts files.
Desc The .shosts files are used to configure host-based authentication for individual users or the system via SSH. Host-based authentication is not sufficient for preventing unauthorized access to the system, as it does not require interactive identification and authentication of a connection request, or for the use of two-factor authentication.
Severity high
Impact 0.7
Nist Controls CM-6 b, Rev_4
Check Text Verify there are no ".shosts" files on the system. Check the system for the existence of these files with the following command: # find / -name '*.shosts' If any ".shosts" files are found on the system, this is a finding.
Fix Text Remove any found ".shosts" files from the system. # rm /[path]/[to]/[file]/.shosts

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72277" do title "The Red Hat Enterprise Linux operating system must not contain .shosts files." desc "The .shosts files are used to configure host-based authentication for individual users or the system via SSH. Host-based authentication is not sufficient for preventing unauthorized access to the system, as it does not require interactive identification and authentication of a connection request, or for the use of two-factor authentication." desc "rationale", "" desc "check", " Verify there are no \".shosts\" files on the system. Check the system for the existence of these files with the following command: # find / -name '*.shosts' If any \".shosts\" files are found on the system, this is a finding. " desc "fix", " Remove any found \".shosts\" files from the system. # rm /[path]/[to]/[file]/.shosts " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72277" tag rid: "SV-86901r2_rule" tag stig_id: "RHEL-07-040540" tag fix_id: "F-78631r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe command("find / -xautofs -name '*.shosts'") do its('stdout.strip') { should be_empty } end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one.
Test Results

Status passed
Test Auditd Rules with file == "/sbin/pam_timestamp_check" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/sbin/pam_timestamp_check" action is expected not to include "never"
Result
Status passed
Test ["x"] is expected to include "x"
Result
Result Details

Control V-72185
Title The Red Hat Enterprise Linux operating system must audit all uses of the pam_timestamp_check command.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one.
Severity medium
Impact 0.5
Nist Controls AU-12 c, Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "pam_timestamp_check" command occur. Check the auditing rules in "/etc/audit/audit.rules" with the following command: # grep -iw "/usr/sbin/pam_timestamp_check" /etc/audit/audit.rules -a always,exit -F path=/usr/sbin/pam_timestamp_check -F auid>=1000 -F auid!=4294967295 -k privileged-pam If the command does not return any output, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "pam_timestamp_check" command occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules": -a always,exit -F path=/usr/sbin/pam_timestamp_check -F auid>=1000 -F auid!=4294967295 -k privileged-pam The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72185" do title "The Red Hat Enterprise Linux operating system must audit all uses of the pam_timestamp_check command." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one." desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"pam_timestamp_check\" command occur. Check the auditing rules in \"/etc/audit/audit.rules\" with the following command: # grep -iw \"/usr/sbin/pam_timestamp_check\" /etc/audit/audit.rules -a always,exit -F path=/usr/sbin/pam_timestamp_check -F auid>=1000 -F auid!=4294967295 -k privileged-pam If the command does not return any output, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"pam_timestamp_check\" command occur. Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F path=/usr/sbin/pam_timestamp_check -F auid>=1000 -F auid!=4294967295 -k privileged-pam The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000471-GPOS-00215" tag gid: "V-72185" tag rid: "SV-86809r4_rule" tag stig_id: "RHEL-07-030810" tag fix_id: "F-78539r4_fix" tag cci: ["CCI-000172"] tag nist: ["AU-12 c", "Rev_4"] audit_file = '/sbin/pam_timestamp_check' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'x' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
If the group owner of the "cron.allow" file is not set to root, sensitive information could be viewed or edited by unauthorized users.
Test Results

Status passed
Test File /etc/cron.allow group is expected to eq "root"
Result
Result Details

Control V-72055
Title The Red Hat Enterprise Linux operating system must be configured so that the cron.allow file, if it exists, is group-owned by root.
Desc If the group owner of the "cron.allow" file is not set to root, sensitive information could be viewed or edited by unauthorized users.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify that the "cron.allow" file is group-owned by root. Check the group owner of the "cron.allow" file with the following command: # ls -al /etc/cron.allow -rw------- 1 root root 6 Mar 5 2011 /etc/cron.allow If the "cron.allow" file exists and has a group owner other than root, this is a finding.
Fix Text Set the group owner on the "/etc/cron.allow" file to root with the following command: # chgrp root /etc/cron.allow

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72055" do title "The Red Hat Enterprise Linux operating system must be configured so that the cron.allow file, if it exists, is group-owned by root." desc "If the group owner of the \"cron.allow\" file is not set to root, sensitive information could be viewed or edited by unauthorized users." desc "rationale", "" desc "check", " Verify that the \"cron.allow\" file is group-owned by root. Check the group owner of the \"cron.allow\" file with the following command: # ls -al /etc/cron.allow -rw------- 1 root root 6 Mar 5 2011 /etc/cron.allow If the \"cron.allow\" file exists and has a group owner other than root, this is a finding. " desc "fix", " Set the group owner on the \"/etc/cron.allow\" file to root with the following command: # chgrp root /etc/cron.allow " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72055" tag rid: "SV-86679r2_rule" tag stig_id: "RHEL-07-021120" tag fix_id: "F-78407r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe.one do # case where file doesn't exist describe file('/etc/cron.allow') do it { should_not exist } end # case where file exists describe file('/etc/cron.allow') do its('group') { should eq 'root' } end end end
An operating system release is considered "supported" if the vendor continues to provide security patches for the product. With an unsupported release, it will not be possible to resolve security issues discovered in the system software.
Test Results

Status passed
Test File /etc/redhat-release content is expected to match /Release (6.7*|7.[2-9].*)/i
Result
Result Details

Control V-71997
Title The Red Hat Enterprise Linux operating system must be a vendor supported release.
Desc An operating system release is considered "supported" if the vendor continues to provide security patches for the product. With an unsupported release, it will not be possible to resolve security issues discovered in the system software.
Severity high
Impact 0.7
Nist Controls CM-6 b, Rev_4
Check Text Verify the version of the operating system is vendor supported. Check the version of the operating system with the following command: # cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.4 (Maipo) Current End of Life for RHEL 7.1 is 31 March 2017. Current End of Life for RHEL 7.2 is 30 November 2017. Current End of Life for RHEL 7.3 is 30 November 2018. Current End of Life for RHEL 7.4 is 31 August 2019. Current End of Life for RHEL 7.5 is 30 April 2020. Current End of Life for RHEL 7.6 is 31 October 2020. Current End of Life for RHEL 7.7 is 30 August 2021. If the release is not supported by the vendor, this is a finding.
Fix Text Upgrade to a supported version of the operating system.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71997" do title "The Red Hat Enterprise Linux operating system must be a vendor supported release." desc "An operating system release is considered \"supported\" if the vendor continues to provide security patches for the product. With an unsupported release, it will not be possible to resolve security issues discovered in the system software." desc "rationale", "" desc "check", " Verify the version of the operating system is vendor supported. Check the version of the operating system with the following command: # cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.4 (Maipo) Current End of Life for RHEL 7.1 is 31 March 2017. Current End of Life for RHEL 7.2 is 30 November 2017. Current End of Life for RHEL 7.3 is 30 November 2018. Current End of Life for RHEL 7.4 is 31 August 2019. Current End of Life for RHEL 7.5 is 30 April 2020. Current End of Life for RHEL 7.6 is 31 October 2020. Current End of Life for RHEL 7.7 is 30 August 2021. If the release is not supported by the vendor, this is a finding. " desc "fix", "Upgrade to a supported version of the operating system." impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-71997" tag rid: "SV-86621r5_rule" tag stig_id: "RHEL-07-020250" tag fix_id: "F-78349r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe file('/etc/redhat-release') do its('content') { should match %r{Release (6.7*|7.[2-9].*)}i } end end
Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised.
Test Results

Status passed
Test Parse Config File /etc/security/pwquality.conf dcredit.to_i is expected to cmp < 0
Result
Result Details

Control V-71907
Title The Red Hat Enterprise Linux operating system must be configured so that when passwords are changed or new passwords are assigned, the new password must contain at least one numeric character.
Desc Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised.
Severity medium
Impact 0.5
Nist Controls IA-5 (1) (a), Rev_4
Check Text Note: The value to require a number of numeric characters to be set is expressed as a negative number in "/etc/security/pwquality.conf". Check the value for "dcredit" in "/etc/security/pwquality.conf" with the following command: # grep dcredit /etc/security/pwquality.conf dcredit = -1 If the value of "dcredit" is not set to a negative value, this is a finding.
Fix Text Configure the operating system to enforce password complexity by requiring that at least one numeric character be used by setting the "dcredit" option. Add the following line to /etc/security/pwquality.conf (or modify the line to have the required value): dcredit = -1

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71907" do title "The Red Hat Enterprise Linux operating system must be configured so that when passwords are changed or new passwords are assigned, the new password must contain at least one numeric character." desc "Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised. " desc "rationale", "" desc "check", " Note: The value to require a number of numeric characters to be set is expressed as a negative number in \"/etc/security/pwquality.conf\". Check the value for \"dcredit\" in \"/etc/security/pwquality.conf\" with the following command: # grep dcredit /etc/security/pwquality.conf dcredit = -1 If the value of \"dcredit\" is not set to a negative value, this is a finding. " desc "fix", " Configure the operating system to enforce password complexity by requiring that at least one numeric character be used by setting the \"dcredit\" option. Add the following line to /etc/security/pwquality.conf (or modify the line to have the required value): dcredit = -1 " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000071-GPOS-00039" tag gid: "V-71907" tag rid: "SV-86531r3_rule" tag stig_id: "RHEL-07-010140" tag fix_id: "F-78259r1_fix" tag cci: ["CCI-000194"] tag nist: ["IA-5 (1) (a)", "Rev_4"] describe parse_config_file("/etc/security/pwquality.conf") do its('dcredit.to_i') { should cmp < 0 } end end
Without verification of the security functions, security functions may not operate correctly and the failure may go unnoticed. Security function is defined as the hardware, software, and/or firmware of the information system responsible for enforcing the system security policy and supporting the isolation of code and data on which the protection is based. Security functionality includes, but is not limited to, establishing system accounts, configuring access authorizations (i.e., permissions, privileges), setting events to be audited, and setting intrusion detection parameters. This requirement applies to operating systems performing security function verification/testing and/or systems and environments that require this functionality.
Test Results

Status passed
Test Command: `sestatus` stdout is expected to match /^Loaded\spolicy\sname:\s+targeted\n?$/
Result
Result Details

Control V-71991
Title The Red Hat Enterprise Linux operating system must enable the SELinux targeted policy.
Desc Without verification of the security functions, security functions may not operate correctly and the failure may go unnoticed. Security function is defined as the hardware, software, and/or firmware of the information system responsible for enforcing the system security policy and supporting the isolation of code and data on which the protection is based. Security functionality includes, but is not limited to, establishing system accounts, configuring access authorizations (i.e., permissions, privileges), setting events to be audited, and setting intrusion detection parameters. This requirement applies to operating systems performing security function verification/testing and/or systems and environments that require this functionality.
Severity high
Impact 0.7
Nist Controls AC-3 (4), SI-6 a, Rev_4
Check Text If an HBSS or HIPS is active on the system, this is Not Applicable. Verify the operating system verifies correct operation of all security functions. Check if "SELinux" is active and is enforcing the targeted policy with the following command: # sestatus SELinux status: enabled SELinuxfs mount: /selinux SELinux root directory: /etc/selinux Loaded policy name: targeted Current mode: enforcing Mode from config file: enforcing Policy MLS status: enabled Policy deny_unknown status: allowed Max kernel policy version: 28 If the "Loaded policy name" is not set to "targeted", this is a finding. Verify that the /etc/selinux/config file is configured to the "SELINUXTYPE" to "targeted": # grep -i "selinuxtype" /etc/selinux/config | grep -v '^#' SELINUXTYPE = targeted If no results are returned or "SELINUXTYPE" is not set to "targeted", this is a finding.
Fix Text Configure the operating system to verify correct operation of all security functions. Set the "SELinuxtype" to the "targeted" policy by modifying the "/etc/selinux/config" file to have the following line: SELINUXTYPE=targeted A reboot is required for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71991" do title "The Red Hat Enterprise Linux operating system must enable the SELinux targeted policy." desc "Without verification of the security functions, security functions may not operate correctly and the failure may go unnoticed. Security function is defined as the hardware, software, and/or firmware of the information system responsible for enforcing the system security policy and supporting the isolation of code and data on which the protection is based. Security functionality includes, but is not limited to, establishing system accounts, configuring access authorizations (i.e., permissions, privileges), setting events to be audited, and setting intrusion detection parameters. This requirement applies to operating systems performing security function verification/testing and/or systems and environments that require this functionality. " desc "rationale", "" desc "check", " If an HBSS or HIPS is active on the system, this is Not Applicable. Verify the operating system verifies correct operation of all security functions. Check if \"SELinux\" is active and is enforcing the targeted policy with the following command: # sestatus SELinux status: enabled SELinuxfs mount: /selinux SELinux root directory: /etc/selinux Loaded policy name: targeted Current mode: enforcing Mode from config file: enforcing Policy MLS status: enabled Policy deny_unknown status: allowed Max kernel policy version: 28 If the \"Loaded policy name\" is not set to \"targeted\", this is a finding. Verify that the /etc/selinux/config file is configured to the \"SELINUXTYPE\" to \"targeted\": # grep -i \"selinuxtype\" /etc/selinux/config | grep -v '^#' SELINUXTYPE = targeted If no results are returned or \"SELINUXTYPE\" is not set to \"targeted\", this is a finding. " desc "fix", " Configure the operating system to verify correct operation of all security functions. Set the \"SELinuxtype\" to the \"targeted\" policy by modifying the \"/etc/selinux/config\" file to have the following line: SELINUXTYPE=targeted A reboot is required for the changes to take effect. " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000445-GPOS-00199" tag gid: "V-71991" tag rid: "SV-86615r5_rule" tag stig_id: "RHEL-07-020220" tag fix_id: "F-78343r2_fix" tag cci: ["CCI-002165", "CCI-002696"] tag nist: ["AC-3 (4)", "SI-6 a", "Rev_4"] describe.one do describe command('sestatus') do its('stdout') { should match %r{^Policy\sfrom\sconfigs\sfile:\s+targeted\n?$} } end describe command('sestatus') do its('stdout') { should match %r{^Loaded\spolicy\sname:\s+targeted\n?$} } end end end
The "nosuid" mount option causes the system to not execute "setuid" and "setgid" files with owner privileges. This option must be used for mounting any file system not containing approved "setuid" and "setguid" files. Executing files from untrusted file systems increases the opportunity for unprivileged users to attain unauthorized administrative access.
Test Results

Status passed
Test No NFS file systems were found. is expected to eq true
Result
Result Details

Control V-72045
Title The Red Hat Enterprise Linux operating system must prevent files with the setuid and setgid bit set from being executed on file systems that are being imported via Network File System (NFS).
Desc The "nosuid" mount option causes the system to not execute "setuid" and "setgid" files with owner privileges. This option must be used for mounting any file system not containing approved "setuid" and "setguid" files. Executing files from untrusted file systems increases the opportunity for unprivileged users to attain unauthorized administrative access.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify file systems that are being NFS imported are configured with the "nosuid" option. Find the file system(s) that contain the directories being exported with the following command: # more /etc/fstab | grep nfs UUID=e06097bb-cfcd-437b-9e4d-a691f5662a7d /store nfs rw,nosuid 0 0 If a file system found in "/etc/fstab" refers to NFS and it does not have the "nosuid" option set, this is a finding. Verify the NFS is mounted with the "nosuid" option: # mount | grep nfs | grep nosuid If no results are returned, this is a finding.
Fix Text Configure the "/etc/fstab" to use the "nosuid" option on file systems that are being imported via NFS.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72045" do title "The Red Hat Enterprise Linux operating system must prevent files with the setuid and setgid bit set from being executed on file systems that are being imported via Network File System (NFS)." desc "The \"nosuid\" mount option causes the system to not execute \"setuid\" and \"setgid\" files with owner privileges. This option must be used for mounting any file system not containing approved \"setuid\" and \"setguid\" files. Executing files from untrusted file systems increases the opportunity for unprivileged users to attain unauthorized administrative access." desc "rationale", "" desc "check", " Verify file systems that are being NFS imported are configured with the \"nosuid\" option. Find the file system(s) that contain the directories being exported with the following command: # more /etc/fstab | grep nfs UUID=e06097bb-cfcd-437b-9e4d-a691f5662a7d /store nfs rw,nosuid 0 0 If a file system found in \"/etc/fstab\" refers to NFS and it does not have the \"nosuid\" option set, this is a finding. Verify the NFS is mounted with the \"nosuid\" option: # mount | grep nfs | grep nosuid If no results are returned, this is a finding. " desc "fix", "Configure the \"/etc/fstab\" to use the \"nosuid\" option on file systems that are being imported via NFS." impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72045" tag rid: "SV-86669r2_rule" tag stig_id: "RHEL-07-021020" tag fix_id: "F-78397r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] nfs_systems = etc_fstab.nfs_file_systems.entries if !nfs_systems.nil? and !nfs_systems.empty? nfs_systems.each do |partition| describe partition do its('mount_options') { should include 'nosuid' } end end else describe "No NFS file systems were found." do subject { nfs_systems.nil? or nfs_systems.empty? } it { should eq true } end end end
SSHv1 is an insecure implementation of the SSH protocol and has many well-known vulnerability exploits. Exploits of the SSH daemon could provide immediate root access to the system.
Test Results

Status skipped
Test The release is 7.8
Result
Result Details

Control V-72251
Title The Red Hat Enterprise Linux operating system must be configured so that the SSH daemon is configured to only use the SSHv2 protocol.
Desc SSHv1 is an insecure implementation of the SSH protocol and has many well-known vulnerability exploits. Exploits of the SSH daemon could provide immediate root access to the system.
Severity none
Nist Controls IA-5 (1) (c), CM-6 b, Rev_4
Check Text Check the version of the operating system with the following command: # cat /etc/redhat-release If the release is 7.4 or newer this requirement is Not Applicable. Verify the SSH daemon is configured to only use the SSHv2 protocol. Check that the SSH daemon is configured to only use the SSHv2 protocol with the following command: # grep -i protocol /etc/ssh/sshd_config Protocol 2 #Protocol 1,2 If any protocol line other than "Protocol 2" is uncommented, this is a finding.
Fix Text Remove all Protocol lines that reference version "1" in "/etc/ssh/sshd_config" (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor). The "Protocol" line must be as follows: Protocol 2 The SSH service must be restarted for changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72251" do title "The Red Hat Enterprise Linux operating system must be configured so that the SSH daemon is configured to only use the SSHv2 protocol." desc "SSHv1 is an insecure implementation of the SSH protocol and has many well-known vulnerability exploits. Exploits of the SSH daemon could provide immediate root access to the system. " desc "rationale", "" desc "check", " Check the version of the operating system with the following command: # cat /etc/redhat-release If the release is 7.4 or newer this requirement is Not Applicable. Verify the SSH daemon is configured to only use the SSHv2 protocol. Check that the SSH daemon is configured to only use the SSHv2 protocol with the following command: # grep -i protocol /etc/ssh/sshd_config Protocol 2 #Protocol 1,2 If any protocol line other than \"Protocol 2\" is uncommented, this is a finding. " desc "fix", " Remove all Protocol lines that reference version \"1\" in \"/etc/ssh/sshd_config\" (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor). The \"Protocol\" line must be as follows: Protocol 2 The SSH service must be restarted for changes to take effect. " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000074-GPOS-00042" tag satisfies: ["SRG-OS-000074-GPOS-00042", "SRG-OS-000480-GPOS-00227"] tag gid: "V-72251" tag rid: "SV-86875r4_rule" tag stig_id: "RHEL-07-040390" tag fix_id: "F-78605r2_fix" tag cci: ["CCI-000197", "CCI-000366"] tag nist: ["IA-5 (1) (c)", "CM-6 b", "Rev_4"] if os.release.to_f >= 7.4 impact 0.0 describe "The release is #{os.release}" do skip "The release is newer than 7.4; this control is Not Applicable." end else describe sshd_config do its('Protocol') { should cmp '2' } end end end
By limiting the number of failed logon attempts, the risk of unauthorized system access via user password guessing, otherwise known as brute forcing, is reduced. Limits are imposed by locking the account.
Test Results

Status passed
Test PAM Config[/etc/pam.d/password-auth] lines is expected to include ["auth required pam_faillock.so even_deny_root", "auth sufficient pam_unix.so try_first_pass", "auth [default=die] pam_faillock.so even_deny_root"]
Result expected "account required pam_unix.so\naccount sufficient pam_localuser.so\naccount sufficient pam_succeed_if...eed_if.so service in crond quiet use_uid\nsession required pam_unix.so\nsession optional pam_sss.so" to include ["auth required pam_faillock.so even_deny_root", "auth sufficient pam_unix.so try_first_pass", "auth [default=die] pam_faillock.so even_deny_root"] Diff: @@ -1,4 +1,28 @@ -auth required pam_faillock.so even_deny_root -auth sufficient pam_unix.so try_first_pass -auth [default=die] pam_faillock.so even_deny_root +account required pam_unix.so +account sufficient pam_localuser.so +account sufficient pam_succeed_if.so uid < 1000 quiet +account [default=bad success=ok user_unknown=ignore] pam_sss.so +account required pam_permit.so +auth required pam_env.so +auth [default=1 ignore=ignore success=ok] pam_succeed_if.so uid >= 1000 quiet +auth [default=4 ignore=ignore success=ok] pam_localuser.so +auth requisite pam_faillock.so preauth deny=3 unlock_time=604800 fail_interval=900 +auth [success=1 default=bad] pam_unix.so try_first_pass +auth [default=die] pam_faillock.so authfail deny=3 unlock_time=604800 fail_interval=900 +auth sufficient pam_faillock.so authsucc deny=3 unlock_time=604800 fail_interval=900 +auth requisite pam_succeed_if.so uid >= 1000 quiet_success +auth sufficient pam_sss.so forward_pass +auth required pam_deny.so +password requisite pam_pwquality.so try_first_pass local_users_only retry=3 authtok_type= +password requisite pam_pwhistory.so use_authtok remember=5 retry=3 +password sufficient pam_unix.so sha512 shadow try_first_pass use_authtok +password sufficient pam_sss.so use_authtok +password required pam_deny.so +session optional pam_keyinit.so revoke +session required pam_limits.so +-session optional pam_systemd.so +session optional pam_oddjob_mkhomedir.so umask=0077 +session [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid +session required pam_unix.so +session optional pam_sss.so
Status passed
Test PAM Config[/etc/pam.d/password-auth] lines is expected to include auth .* pam_faillock.so (preauth|authfail), all with args even_deny_root
Result expected "auth requisite pam_faillock.so preauth deny=3 unlock_time=604800 fail_interval=900\nauth [default=die] pam_faillock.so authfail deny=3 unlock_time=604800 fail_interval=900" to include auth .* pam_faillock.so (preauth|authfail), all with args even_deny_root Diff: @@ -1,2 +1,3 @@ -auth .* pam_faillock.so (preauth|authfail) +auth requisite pam_faillock.so preauth deny=3 unlock_time=604800 fail_interval=900 +auth [default=die] pam_faillock.so authfail deny=3 unlock_time=604800 fail_interval=900
Status passed
Test PAM Config[/etc/pam.d/system-auth] lines is expected to include ["auth required pam_faillock.so even_deny_root", "auth sufficient pam_unix.so try_first_pass", "auth [default=die] pam_faillock.so even_deny_root"]
Result expected "account required pam_unix.so\naccount sufficient pam_localuser.so\naccount sufficient pam_succeed_if...eed_if.so service in crond quiet use_uid\nsession required pam_unix.so\nsession optional pam_sss.so" to include ["auth required pam_faillock.so even_deny_root", "auth sufficient pam_unix.so try_first_pass", "auth [default=die] pam_faillock.so even_deny_root"] Diff: @@ -1,4 +1,28 @@ -auth required pam_faillock.so even_deny_root -auth sufficient pam_unix.so try_first_pass -auth [default=die] pam_faillock.so even_deny_root +account required pam_unix.so +account sufficient pam_localuser.so +account sufficient pam_succeed_if.so uid < 1000 quiet +account [default=bad success=ok user_unknown=ignore] pam_sss.so +account required pam_permit.so +auth required pam_env.so +auth [default=1 ignore=ignore success=ok] pam_succeed_if.so uid >= 1000 quiet +auth [default=4 ignore=ignore success=ok] pam_localuser.so +auth requisite pam_faillock.so preauth deny=3 unlock_time=604800 fail_interval=900 +auth [success=1 default=bad] pam_unix.so try_first_pass +auth [default=die] pam_faillock.so authfail deny=3 unlock_time=604800 fail_interval=900 +auth sufficient pam_faillock.so authsucc deny=3 unlock_time=604800 fail_interval=900 +auth requisite pam_succeed_if.so uid >= 1000 quiet_success +auth sufficient pam_sss.so forward_pass +auth required pam_deny.so +password requisite pam_pwquality.so try_first_pass local_users_only retry=3 authtok_type= +password requisite pam_pwhistory.so use_authtok remember=5 retry=3 +password sufficient pam_unix.so sha512 shadow try_first_pass use_authtok +password sufficient pam_sss.so use_authtok +password required pam_deny.so +session optional pam_keyinit.so revoke +session required pam_limits.so +-session optional pam_systemd.so +session optional pam_oddjob_mkhomedir.so umask=0077 +session [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid +session required pam_unix.so +session optional pam_sss.so
Status passed
Test PAM Config[/etc/pam.d/system-auth] lines is expected to include auth .* pam_faillock.so (preauth|authfail), all with args even_deny_root
Result expected "auth requisite pam_faillock.so preauth deny=3 unlock_time=604800 fail_interval=900\nauth [default=die] pam_faillock.so authfail deny=3 unlock_time=604800 fail_interval=900" to include auth .* pam_faillock.so (preauth|authfail), all with args even_deny_root Diff: @@ -1,2 +1,3 @@ -auth .* pam_faillock.so (preauth|authfail) +auth requisite pam_faillock.so preauth deny=3 unlock_time=604800 fail_interval=900 +auth [default=die] pam_faillock.so authfail deny=3 unlock_time=604800 fail_interval=900
Result Details

Control V-71945
Title The Red Hat Enterprise Linux operating system must lock the associated account after three unsuccessful root logon attempts are made within a 15-minute period.
Desc By limiting the number of failed logon attempts, the risk of unauthorized system access via user password guessing, otherwise known as brute forcing, is reduced. Limits are imposed by locking the account.
Severity medium
Impact 0.5
Nist Controls AC-7 b, Rev_4
Check Text Verify the operating system automatically locks the root account until it is released by an administrator when three unsuccessful logon attempts in 15 minutes are made. # grep pam_faillock.so /etc/pam.d/password-auth auth required pam_faillock.so preauth silent audit deny=3 even_deny_root fail_interval=900 unlock_time=900 auth [default=die] pam_faillock.so authfail audit deny=3 even_deny_root fail_interval=900 unlock_time=900 account required pam_faillock.so If the "even_deny_root" setting is not defined on both lines with the "pam_faillock.so" module, is commented out, or is missing from a line, this is a finding. # grep pam_faillock.so /etc/pam.d/system-auth auth required pam_faillock.so preauth silent audit deny=3 even_deny_root fail_interval=900 unlock_time=900 auth [default=die] pam_faillock.so authfail audit deny=3 even_deny_root fail_interval=900 unlock_time=900 account required pam_faillock.so If the "even_deny_root" setting is not defined on both lines with the "pam_faillock.so" module, is commented out, or is missing from a line, this is a finding.
Fix Text Configure the operating system to lock automatically the root account until the locked account is released by an administrator when three unsuccessful logon attempts in 15 minutes are made. Modify the first three lines of the auth section and the first line of the account section of the "/etc/pam.d/system-auth" and "/etc/pam.d/password-auth" files to match the following lines: auth required pam_faillock.so preauth silent audit deny=3 even_deny_root fail_interval=900 unlock_time=900 auth sufficient pam_unix.so try_first_pass auth [default=die] pam_faillock.so authfail audit deny=3 even_deny_root fail_interval=900 unlock_time=900 account required pam_faillock.so Note: Manual changes to the listed files may be overwritten by the "authconfig" program. The "authconfig" program should not be used to update the configurations listed in this requirement.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71945" do title "The Red Hat Enterprise Linux operating system must lock the associated account after three unsuccessful root logon attempts are made within a 15-minute period." desc "By limiting the number of failed logon attempts, the risk of unauthorized system access via user password guessing, otherwise known as brute forcing, is reduced. Limits are imposed by locking the account. " desc "rationale", "" desc "check", " Verify the operating system automatically locks the root account until it is released by an administrator when three unsuccessful logon attempts in 15 minutes are made. # grep pam_faillock.so /etc/pam.d/password-auth auth required pam_faillock.so preauth silent audit deny=3 even_deny_root fail_interval=900 unlock_time=900 auth [default=die] pam_faillock.so authfail audit deny=3 even_deny_root fail_interval=900 unlock_time=900 account required pam_faillock.so If the \"even_deny_root\" setting is not defined on both lines with the \"pam_faillock.so\" module, is commented out, or is missing from a line, this is a finding. # grep pam_faillock.so /etc/pam.d/system-auth auth required pam_faillock.so preauth silent audit deny=3 even_deny_root fail_interval=900 unlock_time=900 auth [default=die] pam_faillock.so authfail audit deny=3 even_deny_root fail_interval=900 unlock_time=900 account required pam_faillock.so If the \"even_deny_root\" setting is not defined on both lines with the \"pam_faillock.so\" module, is commented out, or is missing from a line, this is a finding. " desc "fix", " Configure the operating system to lock automatically the root account until the locked account is released by an administrator when three unsuccessful logon attempts in 15 minutes are made. Modify the first three lines of the auth section and the first line of the account section of the \"/etc/pam.d/system-auth\" and \"/etc/pam.d/password-auth\" files to match the following lines: auth required pam_faillock.so preauth silent audit deny=3 even_deny_root fail_interval=900 unlock_time=900 auth sufficient pam_unix.so try_first_pass auth [default=die] pam_faillock.so authfail audit deny=3 even_deny_root fail_interval=900 unlock_time=900 account required pam_faillock.so Note: Manual changes to the listed files may be overwritten by the \"authconfig\" program. The \"authconfig\" program should not be used to update the configurations listed in this requirement. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000329-GPOS-00128" tag satisfies: ["SRG-OS-000329-GPOS-00128", "SRG-OS-000021-GPOS-00005"] tag gid: "V-71945" tag rid: "SV-86569r4_rule" tag stig_id: "RHEL-07-010330" tag fix_id: "F-78297r3_fix" tag cci: ["CCI-002238"] tag nist: ["AC-7 b", "Rev_4"] required_lines = [ 'auth required pam_faillock.so even_deny_root', 'auth sufficient pam_unix.so try_first_pass', 'auth [default=die] pam_faillock.so even_deny_root' ] describe pam('/etc/pam.d/password-auth') do its('lines') { should match_pam_rules(required_lines) } its('lines') { should match_pam_rule('auth .* pam_faillock.so (preauth|authfail)').all_with_args('even_deny_root') } end describe pam('/etc/pam.d/system-auth') do its('lines') { should match_pam_rules(required_lines) } its('lines') { should match_pam_rule('auth .* pam_faillock.so (preauth|authfail)').all_with_args('even_deny_root') } end end
Display of a standardized and approved use notification before granting access to the operating system ensures privacy and security notification verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. System use notifications are required only for access via logon interfaces with human users and are not required when such human interfaces do not exist. The banner must be formatted in accordance with applicable DoD policy. Use the following verbiage for operating systems that can accommodate banners of 1300 characters: "You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. By using this IS (which includes any device attached to this IS), you consent to the following conditions: -The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations. -At any time, the USG may inspect and seize data stored on this IS. -Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose. -This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy. -Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details."
Test Results

Status skipped
Test The system does not have GNOME installed
Result
Result Details

Control V-71861
Title The Red Hat Enterprise Linux operating system must display the approved Standard Mandatory DoD Notice and Consent Banner before granting local or remote access to the system via a graphical user logon.
Desc Display of a standardized and approved use notification before granting access to the operating system ensures privacy and security notification verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. System use notifications are required only for access via logon interfaces with human users and are not required when such human interfaces do not exist. The banner must be formatted in accordance with applicable DoD policy. Use the following verbiage for operating systems that can accommodate banners of 1300 characters: "You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. By using this IS (which includes any device attached to this IS), you consent to the following conditions: -The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations. -At any time, the USG may inspect and seize data stored on this IS. -Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose. -This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy. -Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details."
Severity none
Nist Controls AC-8 a, Rev_4
Check Text Verify the operating system displays the approved Standard Mandatory DoD Notice and Consent Banner before granting access to the operating system via a graphical user logon. Note: If the system does not have GNOME installed, this requirement is Not Applicable. Check that the operating system displays the exact approved Standard Mandatory DoD Notice and Consent Banner text with the command: # grep banner-message-text /etc/dconf/db/local.d/* banner-message-text= 'You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. By using this IS (which includes any device attached to this IS), you consent to the following conditions: -The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations. -At any time, the USG may inspect and seize data stored on this IS. -Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose. -This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy. -Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details. ' Note: The " " characters are for formatting only. They will not be displayed on the GUI. If the banner does not match the approved Standard Mandatory DoD Notice and Consent Banner, this is a finding.
Fix Text Configure the operating system to display the approved Standard Mandatory DoD Notice and Consent Banner before granting access to the system. Note: If the system does not have GNOME installed, this requirement is Not Applicable. Create a database to contain the system-wide graphical user logon settings (if it does not already exist) with the following command: # touch /etc/dconf/db/local.d/01-banner-message Add the following line to the [org/gnome/login-screen] section of the "/etc/dconf/db/local.d/01-banner-message": [org/gnome/login-screen] banner-message-enable=true banner-message-text='You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. By using this IS (which includes any device attached to this IS), you consent to the following conditions: -The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations. -At any time, the USG may inspect and seize data stored on this IS. -Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose. -This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy. -Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details. ' Note: The " " characters are for formatting only. They will not be displayed on the GUI. Run the following command to update the database: # dconf update

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71861" do title "The Red Hat Enterprise Linux operating system must display the approved Standard Mandatory DoD Notice and Consent Banner before granting local or remote access to the system via a graphical user logon." desc "Display of a standardized and approved use notification before granting access to the operating system ensures privacy and security notification verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. System use notifications are required only for access via logon interfaces with human users and are not required when such human interfaces do not exist. The banner must be formatted in accordance with applicable DoD policy. Use the following verbiage for operating systems that can accommodate banners of 1300 characters: \"You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. By using this IS (which includes any device attached to this IS), you consent to the following conditions: -The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations. -At any time, the USG may inspect and seize data stored on this IS. -Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose. -This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy. -Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details.\" " desc "rationale", "" desc "check", " Verify the operating system displays the approved Standard Mandatory DoD Notice and Consent Banner before granting access to the operating system via a graphical user logon. Note: If the system does not have GNOME installed, this requirement is Not Applicable. Check that the operating system displays the exact approved Standard Mandatory DoD Notice and Consent Banner text with the command: # grep banner-message-text /etc/dconf/db/local.d/* banner-message-text= 'You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only.\ By using this IS (which includes any device attached to this IS), you consent to the following conditions:\ -The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations.\ -At any time, the USG may inspect and seize data stored on this IS.\ -Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose.\ -This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy.\ -Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details. ' Note: The \"\ \" characters are for formatting only. They will not be displayed on the GUI. If the banner does not match the approved Standard Mandatory DoD Notice and Consent Banner, this is a finding. " desc "fix", " Configure the operating system to display the approved Standard Mandatory DoD Notice and Consent Banner before granting access to the system. Note: If the system does not have GNOME installed, this requirement is Not Applicable. Create a database to contain the system-wide graphical user logon settings (if it does not already exist) with the following command: # touch /etc/dconf/db/local.d/01-banner-message Add the following line to the [org/gnome/login-screen] section of the \"/etc/dconf/db/local.d/01-banner-message\": [org/gnome/login-screen] banner-message-enable=true banner-message-text='You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only.\ By using this IS (which includes any device attached to this IS), you consent to the following conditions:\ -The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations.\ -At any time, the USG may inspect and seize data stored on this IS.\ -Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose.\ -This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy.\ -Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details. ' Note: The \"\ \" characters are for formatting only. They will not be displayed on the GUI. Run the following command to update the database: # dconf update " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000023-GPOS-00006" tag satisfies: ["SRG-OS-000023-GPOS-00006", "SRG-OS-000024-GPOS-00007", "SRG-OS-000228-GPOS-00088"] tag gid: "V-71861" tag rid: "SV-86485r4_rule" tag stig_id: "RHEL-07-010040" tag fix_id: "F-78213r5_fix" tag cci: ["CCI-000048"] tag nist: ["AC-8 a", "Rev_4"] if package('gnome-desktop3').installed? #Get all files that have the banner-message-text specified. banner_files = command("grep -l banner-message-text /etc/dconf/db/local.d/*").stdout.split("\n") #If there are no banner files then this is a finding. banner_missing = banner_files.empty? describe "If no files specify the banner text then this is a finding" do subject { banner_missing } it{should be false} end if banner_missing #If there are banner files then check them to make sure they have the correct text. banner_files.each do |banner_file| banner_message = parse_config_file(banner_file).params("banner-message-text").gsub(%r{[\r\n\s]}, '') #dconf expects the banner-message-text to be quoted so remove leading and trailing quote. #See https://developer.gnome.org/dconf/unstable/dconf-tool.html which states: # VALUE arguments must be in GVariant format, so e.g. a string must include # explicit quotes: "'foo'". This format is also used when printing out values. if banner_message.start_with?('"') || banner_message.start_with?('\'') banner_message = banner_message[1,banner_message.length] end if banner_message.end_with?('"') || banner_message.end_with?('\'') banner_message = banner_message.chop end describe.one do describe banner_message do it{should cmp banner_message_text_gui.gsub(%r{[\r\n\s]}, '')} end describe banner_message do it{should cmp banner_message_text_gui_limited.gsub(%r{[\r\n\s]}, '')} end end end else impact 0.0 describe "The system does not have GNOME installed" do skip "The system does not have GNOME installed, this requirement is Not Applicable." end end end
Operating system management includes the ability to control the number of users and user sessions that utilize an operating system. Limiting the number of allowed users and sessions per user is helpful in reducing the risks related to DoS attacks. This requirement addresses concurrent sessions for information system accounts and does not address concurrent sessions by single users via multiple system accounts. The maximum number of concurrent sessions should be defined based on mission needs and the operational environment for each system.
Test Results

Status passed
Test Files configuring maxlogins less than or equal to 10 is expected to be positive
Result
Status passed
Test Files configuring maxlogins greater than 10 is expected to cmp == []
Result
Result Details

Control V-72217
Title The Red Hat Enterprise Linux operating system must limit the number of concurrent sessions to 10 for all accounts and/or account types.
Desc Operating system management includes the ability to control the number of users and user sessions that utilize an operating system. Limiting the number of allowed users and sessions per user is helpful in reducing the risks related to DoS attacks. This requirement addresses concurrent sessions for information system accounts and does not address concurrent sessions by single users via multiple system accounts. The maximum number of concurrent sessions should be defined based on mission needs and the operational environment for each system.
Severity low
Impact 0.3
Nist Controls AC-10, Rev_4
Check Text Verify the operating system limits the number of concurrent sessions to "10" for all accounts and/or account types by issuing the following command: # grep "maxlogins" /etc/security/limits.conf /etc/security/limits.d/*.conf * hard maxlogins 10 This can be set as a global domain (with the * wildcard) but may be set differently for multiple domains. If the "maxlogins" item is missing, commented out, or the value is not set to "10" or less for all domains that have the "maxlogins" item assigned, this is a finding.
Fix Text Configure the operating system to limit the number of concurrent sessions to "10" for all accounts and/or account types. Add the following line to the top of the /etc/security/limits.conf or in a ".conf" file defined in /etc/security/limits.d/ : * hard maxlogins 10

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72217" do title "The Red Hat Enterprise Linux operating system must limit the number of concurrent sessions to 10 for all accounts and/or account types." desc "Operating system management includes the ability to control the number of users and user sessions that utilize an operating system. Limiting the number of allowed users and sessions per user is helpful in reducing the risks related to DoS attacks. This requirement addresses concurrent sessions for information system accounts and does not address concurrent sessions by single users via multiple system accounts. The maximum number of concurrent sessions should be defined based on mission needs and the operational environment for each system. " desc "rationale", "" desc "check", " Verify the operating system limits the number of concurrent sessions to \"10\" for all accounts and/or account types by issuing the following command: # grep \"maxlogins\" /etc/security/limits.conf /etc/security/limits.d/*.conf * hard maxlogins 10 This can be set as a global domain (with the * wildcard) but may be set differently for multiple domains. If the \"maxlogins\" item is missing, commented out, or the value is not set to \"10\" or less for all domains that have the \"maxlogins\" item assigned, this is a finding. " desc "fix", " Configure the operating system to limit the number of concurrent sessions to \"10\" for all accounts and/or account types. Add the following line to the top of the /etc/security/limits.conf or in a \".conf\" file defined in /etc/security/limits.d/ : * hard maxlogins 10 " impact 0.3 tag severity: nil tag gtitle: "SRG-OS-000027-GPOS-00008" tag gid: "V-72217" tag rid: "SV-86841r3_rule" tag stig_id: "RHEL-07-040000" tag fix_id: "F-78571r2_fix" tag cci: ["CCI-000054"] tag nist: ["AC-10", "Rev_4"] maxlogins_limit = input('maxlogins_limit') # Collect any files under limits.d if they exist limits_files = directory('/etc/security/limits.d').exist? ? command('ls /etc/security/limits.d/*.conf').stdout.strip.lines : [] # Add limits.conf to the list limits_files.push('/etc/security/limits.conf') compliant_files = [] noncompliant_files = [] limits_files.each do |limits_file| # Get any universal limits from each file local_limits = limits_conf(limits_file).* # If we got an array (results) check further if local_limits.is_a?(Array) local_limits.each do |temp_limit| # For each result check if it is a 'hard' limit for 'maxlogins' if temp_limit.include?('hard') && temp_limit.include?('maxlogins') # If the limit is in range, push to compliant files if temp_limit[-1].to_i <= maxlogins_limit compliant_files.push(limits_file) # Otherwise add to noncompliant files else noncompliant_files.push(limits_file) end end end end end # It is required that at least 1 file contain compliant configuration describe "Files configuring maxlogins less than or equal to #{maxlogins_limit}" do subject { compliant_files.length } it { should be_positive } end # No files should set 'hard' 'maxlogins' to any noncompliant value describe "Files configuring maxlogins greater than #{maxlogins_limit}" do subject { noncompliant_files } it { should cmp [] } end end
If a world-writable directory has the sticky bit set and is not group-owned by a privileged Group Identifier (GID), unauthorized users may be able to modify files created by others. The only authorized public directories are those temporary directories supplied with the system or those designed to be temporary file repositories. The setting is normally reserved for directories used by the system and by users for temporary file storage, (e.g., /tmp), and for directories requiring global read/write access.
Test Results

Status passed
Test File /var/tmp group is expected to be in "root", "sys", and "bin"
Result
Status passed
Test File /var/tmp/cloud-init group is expected to be in "root", "sys", and "bin"
Result
Status passed
Test File /var/tmp/systemd-private-d24354a1797e4846b9e800d6f612ef8f-chronyd.service-U8pkhb/tmp group is expected to be in "root", "sys", and "bin"
Result
Status passed
Test File /tmp group is expected to be in "root", "sys", and "bin"
Result
Status passed
Test File /tmp/.XIM-unix group is expected to be in "root", "sys", and "bin"
Result
Status passed
Test File /tmp/.Test-unix group is expected to be in "root", "sys", and "bin"
Result
Status passed
Test File /tmp/.ICE-unix group is expected to be in "root", "sys", and "bin"
Result
Status passed
Test File /tmp/.font-unix group is expected to be in "root", "sys", and "bin"
Result
Status passed
Test File /tmp/.X11-unix group is expected to be in "root", "sys", and "bin"
Result
Status passed
Test File /tmp/systemd-private-d24354a1797e4846b9e800d6f612ef8f-chronyd.service-Te8mBP/tmp group is expected to be in "root", "sys", and "bin"
Result
Result Details

Control V-72047
Title The Red Hat Enterprise Linux operating system must be configured so that all world-writable directories are group-owned by root, sys, bin, or an application group.
Desc If a world-writable directory has the sticky bit set and is not group-owned by a privileged Group Identifier (GID), unauthorized users may be able to modify files created by others. The only authorized public directories are those temporary directories supplied with the system or those designed to be temporary file repositories. The setting is normally reserved for directories used by the system and by users for temporary file storage, (e.g., /tmp), and for directories requiring global read/write access.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify all world-writable directories are group-owned by root, sys, bin, or an application group. Check the system for world-writable directories with the following command: Note: The value after -fstype must be replaced with the filesystem type. XFS is used as an example. # find / -xdev -perm -002 -type d -fstype xfs -exec ls -lLd {} \; drwxrwxrwt 2 root root 40 Aug 26 13:07 /dev/mqueue drwxrwxrwt 2 root root 220 Aug 26 13:23 /dev/shm drwxrwxrwt 14 root root 4096 Aug 26 13:29 /tmp If any world-writable directories are not owned by root, sys, bin, or an application group associated with the directory, this is a finding.
Fix Text Change the group of the world-writable directories to root with the following command: # chgrp root <directory>

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72047" do title "The Red Hat Enterprise Linux operating system must be configured so that all world-writable directories are group-owned by root, sys, bin, or an application group." desc "If a world-writable directory has the sticky bit set and is not group-owned by a privileged Group Identifier (GID), unauthorized users may be able to modify files created by others. The only authorized public directories are those temporary directories supplied with the system or those designed to be temporary file repositories. The setting is normally reserved for directories used by the system and by users for temporary file storage, (e.g., /tmp), and for directories requiring global read/write access. " desc "rationale", "" desc "check", " Verify all world-writable directories are group-owned by root, sys, bin, or an application group. Check the system for world-writable directories with the following command: Note: The value after -fstype must be replaced with the filesystem type. XFS is used as an example. # find / -xdev -perm -002 -type d -fstype xfs -exec ls -lLd {} \\; drwxrwxrwt 2 root root 40 Aug 26 13:07 /dev/mqueue drwxrwxrwt 2 root root 220 Aug 26 13:23 /dev/shm drwxrwxrwt 14 root root 4096 Aug 26 13:29 /tmp If any world-writable directories are not owned by root, sys, bin, or an application group associated with the directory, this is a finding. " desc "fix", " Change the group of the world-writable directories to root with the following command: # chgrp root <directory> " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72047" tag rid: "SV-86671r4_rule" tag stig_id: "RHEL-07-021030" tag fix_id: "F-78399r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] application_groups = input('application_groups') ww_dirs = Set[] partitions = etc_fstab.params.map{|partition| partition['file_system_type']}.uniq partitions.each do |part| cmd = "find / -perm -002 -xdev -type d -fstype #{part} -exec ls -lLd {} \\;" ww_dirs = ww_dirs + command(cmd).stdout.split("\n") end ww_dirs.to_a.each do |curr_dir| dir_arr = curr_dir.split(' ') describe file(dir_arr.last) do its('group') { should be_in ["root","sys","bin"] + application_groups } end end end
Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged mount commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Test Results

Status passed
Test Auditd Rules with file == "/bin/umount" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/bin/umount" action is expected not to include "never"
Result
Status passed
Test ["x"] is expected to include "x"
Result
Result Details

Control V-72173
Title The Red Hat Enterprise Linux operating system must audit all uses of the umount command.
Desc Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged mount commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Severity medium
Impact 0.5
Nist Controls AU-3 (1), MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "umount" command occur. Check that the following system call is being audited by performing the following series of commands to check the file system rules in "/etc/audit/audit.rules": # grep -iw "/usr/bin/umount" /etc/audit/audit.rules -a always,exit -F path=/usr/bin/umount -F auid>=1000 -F auid!=4294967295 -k privileged-mount If the command does not return any output, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "umount" command occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules": -a always,exit -F path=/usr/bin/umount -F auid>=1000 -F auid!=4294967295 -k privileged-mount The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72173" do title "The Red Hat Enterprise Linux operating system must audit all uses of the umount command." desc "Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged mount commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise. " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"umount\" command occur. Check that the following system call is being audited by performing the following series of commands to check the file system rules in \"/etc/audit/audit.rules\": # grep -iw \"/usr/bin/umount\" /etc/audit/audit.rules -a always,exit -F path=/usr/bin/umount -F auid>=1000 -F auid!=4294967295 -k privileged-mount If the command does not return any output, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"umount\" command occur. Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F path=/usr/bin/umount -F auid>=1000 -F auid!=4294967295 -k privileged-mount The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000042-GPOS-00020" tag satisfies: ["SRG-OS-000042-GPOS-00020", "SRG-OS-000392-GPOS-00172"] tag gid: "V-72173" tag rid: "SV-86797r5_rule" tag stig_id: "RHEL-07-030750" tag fix_id: "F-78527r5_fix" tag cci: ["CCI-000135", "CCI-002884"] tag nist: ["AU-3 (1)", "MA-4 (1) (a)", "Rev_4"] audit_file = '/bin/umount' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'x' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged password commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Test Results

Status passed
Test Auditd Rules with file == "/usr/bin/passwd" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/usr/bin/passwd" action is expected not to include "never"
Result
Status passed
Test ["x"] is expected to include "x"
Result
Result Details

Control V-72149
Title The Red Hat Enterprise Linux operating system must audit all uses of the passwd command.
Desc Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged password commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Severity medium
Impact 0.5
Nist Controls AU-3 (1), AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "passwd" command occur. Check the file system rule in "/etc/audit/audit.rules" with the following command: # grep -i /usr/bin/passwd /etc/audit/audit.rules -a always,exit -F path=/usr/bin/passwd -F auid>=1000 -F auid!=4294967295 -k privileged-passwd If the command does not return any output, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "passwd" command occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules": -a always,exit -F path=/usr/bin/passwd -F auid>=1000 -F auid!=4294967295 -k privileged-passwd The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72149" do title "The Red Hat Enterprise Linux operating system must audit all uses of the passwd command." desc "Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged password commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise. " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"passwd\" command occur. Check the file system rule in \"/etc/audit/audit.rules\" with the following command: # grep -i /usr/bin/passwd /etc/audit/audit.rules -a always,exit -F path=/usr/bin/passwd -F auid>=1000 -F auid!=4294967295 -k privileged-passwd If the command does not return any output, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"passwd\" command occur. Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F path=/usr/bin/passwd -F auid>=1000 -F auid!=4294967295 -k privileged-passwd The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000042-GPOS-00020" tag satisfies: ["SRG-OS-000042-GPOS-00020", "SRG-OS-000392-GPOS-00172", "SRG-OS-000471-GPOS-00215"] tag gid: "V-72149" tag rid: "SV-86773r5_rule" tag stig_id: "RHEL-07-030630" tag fix_id: "F-78501r6_fix" tag cci: ["CCI-000135", "CCI-000172", "CCI-002884"] tag nist: ["AU-3 (1)", "AU-12 c", "MA-4 (1) (a)", "Rev_4"] audit_file = '/usr/bin/passwd' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'x' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
Enforcing a minimum password lifetime helps to prevent repeated password changes to defeat the password reuse or history enforcement requirement. If users are allowed to immediately and continually change their password, the password could be repeatedly changed in a short period of time to defeat the organization's policy regarding password reuse.
Test Results

Status passed
Test /etc/shadow with user == "ec2-user" min_days.first.to_i is expected to cmp >= 1
Result
Result Details

Control V-71927
Title The Red Hat Enterprise Linux operating system must be configured so that passwords are restricted to a 24 hours/1 day minimum lifetime.
Desc Enforcing a minimum password lifetime helps to prevent repeated password changes to defeat the password reuse or history enforcement requirement. If users are allowed to immediately and continually change their password, the password could be repeatedly changed in a short period of time to defeat the organization's policy regarding password reuse.
Severity medium
Impact 0.5
Nist Controls IA-5 (1) (d), Rev_4
Check Text Check whether the minimum time period between password changes for each user account is one day or greater. # awk -F: '$4 < 1 {print $1 " " $4}' /etc/shadow If any results are returned that are not associated with a system account, this is a finding.
Fix Text Configure non-compliant accounts to enforce a 24 hours/1 day minimum password lifetime: # chage -m 1 [user]

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71927" do title "The Red Hat Enterprise Linux operating system must be configured so that passwords are restricted to a 24 hours/1 day minimum lifetime." desc "Enforcing a minimum password lifetime helps to prevent repeated password changes to defeat the password reuse or history enforcement requirement. If users are allowed to immediately and continually change their password, the password could be repeatedly changed in a short period of time to defeat the organization's policy regarding password reuse." desc "rationale", "" desc "check", " Check whether the minimum time period between password changes for each user account is one day or greater. # awk -F: '$4 < 1 {print $1 \" \" $4}' /etc/shadow If any results are returned that are not associated with a system account, this is a finding. " desc "fix", " Configure non-compliant accounts to enforce a 24 hours/1 day minimum password lifetime: # chage -m 1 [user] " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000075-GPOS-00043" tag gid: "V-71927" tag rid: "SV-86551r2_rule" tag stig_id: "RHEL-07-010240" tag fix_id: "F-78279r1_fix" tag cci: ["CCI-000198"] tag nist: ["IA-5 (1) (d)", "Rev_4"] shadow.users.each do |user| # filtering on non-system accounts (uid >= 1000) next unless user(user).uid >= 1000 describe shadow.users(user) do its('min_days.first.to_i') { should cmp >= 1 } end end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with syscall == "chmod" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "chmod" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "chmod" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "chmod" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Result Details

Control V-72105
Title The Red Hat Enterprise Linux operating system must audit all uses of the chmod syscall.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-12 c, Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "chmod" syscall occur. Check the file system rules in "/etc/audit/audit.rules" with the following command: # grep -iw chmod /etc/audit/audit.rules -a always,exit -F arch=b32 -S chmod -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S chmod -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the "b32" and "b64" audit rules are not defined for the "chmod" syscall, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "chmod" syscall occur. Add or update the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S chmod -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S chmod -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72105" do title "The Red Hat Enterprise Linux operating system must audit all uses of the chmod syscall." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"chmod\" syscall occur. Check the file system rules in \"/etc/audit/audit.rules\" with the following command: # grep -iw chmod /etc/audit/audit.rules -a always,exit -F arch=b32 -S chmod -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S chmod -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the \"b32\" and \"b64\" audit rules are not defined for the \"chmod\" syscall, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"chmod\" syscall occur. Add or update the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S chmod -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S chmod -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000458-GPOS-00203" tag satisfies: ["SRG-OS-000458-GPOS-00203", "SRG-OS-000392-GPOS-00172", "SRG-OS-000064-GPOS-00033"] tag gid: "V-72105" tag rid: "SV-86729r5_rule" tag stig_id: "RHEL-07-030410" tag fix_id: "F-78457r7_fix" tag cci: ["CCI-000172"] tag nist: ["AU-12 c", "Rev_4"] describe auditd.syscall("chmod").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end if os.arch == 'x86_64' describe auditd.syscall("chmod").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end end end
If a public host key file is modified by an unauthorized user, the SSH service may be compromised.
Test Results

Status passed
Test No files have a more permissive mode. is expected to eq true
Result
Result Details

Control V-72255
Title The Red Hat Enterprise Linux operating system must be configured so that the SSH public host key files have mode 0644 or less permissive.
Desc If a public host key file is modified by an unauthorized user, the SSH service may be compromised.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the SSH public host key files have mode "0644" or less permissive. Note: SSH public key files may be found in other directories on the system depending on the installation. The following command will find all SSH public key files on the system: # find /etc/ssh -name '*.pub' -exec ls -lL {} \; -rw-r--r-- 1 root root 618 Nov 28 06:43 ssh_host_dsa_key.pub -rw-r--r-- 1 root root 347 Nov 28 06:43 ssh_host_key.pub -rw-r--r-- 1 root root 238 Nov 28 06:43 ssh_host_rsa_key.pub If any file has a mode more permissive than "0644", this is a finding.
Fix Text Note: SSH public key files may be found in other directories on the system depending on the installation. Change the mode of public host key files under "/etc/ssh" to "0644" with the following command: # chmod 0644 /etc/ssh/*.key.pub

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72255" do title "The Red Hat Enterprise Linux operating system must be configured so that the SSH public host key files have mode 0644 or less permissive." desc "If a public host key file is modified by an unauthorized user, the SSH service may be compromised." desc "rationale", "" desc "check", " Verify the SSH public host key files have mode \"0644\" or less permissive. Note: SSH public key files may be found in other directories on the system depending on the installation. The following command will find all SSH public key files on the system: # find /etc/ssh -name '*.pub' -exec ls -lL {} \\; -rw-r--r-- 1 root root 618 Nov 28 06:43 ssh_host_dsa_key.pub -rw-r--r-- 1 root root 347 Nov 28 06:43 ssh_host_key.pub -rw-r--r-- 1 root root 238 Nov 28 06:43 ssh_host_rsa_key.pub If any file has a mode more permissive than \"0644\", this is a finding. " desc "fix", " Note: SSH public key files may be found in other directories on the system depending on the installation. Change the mode of public host key files under \"/etc/ssh\" to \"0644\" with the following command: # chmod 0644 /etc/ssh/*.key.pub " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72255" tag rid: "SV-86879r2_rule" tag stig_id: "RHEL-07-040410" tag fix_id: "F-78609r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] pub_files = command("find /etc/ssh -xdev -name '*.pub' -perm /133").stdout.split("\n") if !pub_files.nil? and !pub_files.empty? pub_files.each do |pubfile| describe file(pubfile) do it { should_not be_executable.by('owner') } it { should_not be_executable.by('group') } it { should_not be_writable.by('group') } it { should_not be_executable.by('others') } it { should_not be_writable.by('others') } end end else describe "No files have a more permissive mode." do subject { pub_files.nil? or pub_files.empty? } it { should eq true } end end end
Taking appropriate action in case of a filled audit storage volume will minimize the possibility of losing audit records.
Test Results

Status skipped
Test Parse Config File /etc/audisp/audisp-remote.conf
Result
Status skipped
Test Parse Config File /etc/audisp/audisp-remote.conf
Result
Result Details

Control V-72087
Title The Red Hat Enterprise Linux operating system must be configured so that the audit system takes appropriate action when the audit storage volume is full.
Desc Taking appropriate action in case of a filled audit storage volume will minimize the possibility of losing audit records.
Severity medium
Impact 0.5
Nist Controls AU-4 (1), Rev_4
Check Text Verify the action the operating system takes if the disk the audit records are written to becomes full. To determine the action that takes place if the disk is full on the remote server, use the following command: # grep -i disk_full_action /etc/audisp/audisp-remote.conf disk_full_action = single If the value of the "disk_full_action" option is not "syslog", "single", or "halt", or the line is commented out, this is a finding.
Fix Text Configure the action the operating system takes if the disk the audit records are written to becomes full. Uncomment or edit the "disk_full_action" option in "/etc/audisp/audisp-remote.conf" and set it to "syslog", "single", or "halt", such as the following line: disk_full_action = single

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72087" do title "The Red Hat Enterprise Linux operating system must be configured so that the audit system takes appropriate action when the audit storage volume is full." desc "Taking appropriate action in case of a filled audit storage volume will minimize the possibility of losing audit records." desc "rationale", "" desc "check", " Verify the action the operating system takes if the disk the audit records are written to becomes full. To determine the action that takes place if the disk is full on the remote server, use the following command: # grep -i disk_full_action /etc/audisp/audisp-remote.conf disk_full_action = single If the value of the \"disk_full_action\" option is not \"syslog\", \"single\", or \"halt\", or the line is commented out, this is a finding. " desc "fix", " Configure the action the operating system takes if the disk the audit records are written to becomes full. Uncomment or edit the \"disk_full_action\" option in \"/etc/audisp/audisp-remote.conf\" and set it to \"syslog\", \"single\", or \"halt\", such as the following line: disk_full_action = single " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000342-GPOS-00133" tag gid: "V-72087" tag rid: "SV-86711r3_rule" tag stig_id: "RHEL-07-030320" tag fix_id: "F-78439r4_fix" tag cci: ["CCI-001851"] tag nist: ["AU-4 (1)", "Rev_4"] describe parse_config_file('/etc/audisp/audisp-remote.conf') do its('disk_full_action'.to_s) { should be_in ['syslog', 'single', 'halt'] } end # Test matches ./inspec-profiles/controls/V-73163.rb describe parse_config_file('/etc/audisp/audisp-remote.conf') do its('network_failure_action'.to_s) { should be_in ['syslog', 'single', 'halt'] } end end
GSSAPI authentication is used to provide additional authentication mechanisms to applications. Allowing GSSAPI authentication through SSH exposes the system's GSSAPI to remote hosts, increasing the attack surface of the system. GSSAPI authentication must be disabled unless needed.
Test Results

Status passed
Test SSHD Configuration GSSAPIAuthentication is expected to cmp == "no"
Result
Result Details

Control V-72259
Title The Red Hat Enterprise Linux operating system must be configured so that the SSH daemon does not permit Generic Security Service Application Program Interface (GSSAPI) authentication unless needed.
Desc GSSAPI authentication is used to provide additional authentication mechanisms to applications. Allowing GSSAPI authentication through SSH exposes the system's GSSAPI to remote hosts, increasing the attack surface of the system. GSSAPI authentication must be disabled unless needed.
Severity medium
Impact 0.5
Nist Controls CM-3 f, CM-6 c, CM-11 (2), CM-5 (1), CM-5 (1), Rev_4
Check Text Verify the SSH daemon does not permit GSSAPI authentication unless approved. Check that the SSH daemon does not permit GSSAPI authentication with the following command: # grep -i gssapiauth /etc/ssh/sshd_config GSSAPIAuthentication no If the "GSSAPIAuthentication" keyword is missing, is set to "yes" and is not documented with the Information System Security Officer (ISSO), or the returned line is commented out, this is a finding.
Fix Text Uncomment the "GSSAPIAuthentication" keyword in "/etc/ssh/sshd_config" (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor) and set the value to "no": GSSAPIAuthentication no The SSH service must be restarted for changes to take effect. If GSSAPI authentication is required, it must be documented, to include the location of the configuration file, with the ISSO.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72259" do title "The Red Hat Enterprise Linux operating system must be configured so that the SSH daemon does not permit Generic Security Service Application Program Interface (GSSAPI) authentication unless needed." desc "GSSAPI authentication is used to provide additional authentication mechanisms to applications. Allowing GSSAPI authentication through SSH exposes the system's GSSAPI to remote hosts, increasing the attack surface of the system. GSSAPI authentication must be disabled unless needed." desc "rationale", "" desc "check", " Verify the SSH daemon does not permit GSSAPI authentication unless approved. Check that the SSH daemon does not permit GSSAPI authentication with the following command: # grep -i gssapiauth /etc/ssh/sshd_config GSSAPIAuthentication no If the \"GSSAPIAuthentication\" keyword is missing, is set to \"yes\" and is not documented with the Information System Security Officer (ISSO), or the returned line is commented out, this is a finding. " desc "fix", " Uncomment the \"GSSAPIAuthentication\" keyword in \"/etc/ssh/sshd_config\" (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor) and set the value to \"no\": GSSAPIAuthentication no The SSH service must be restarted for changes to take effect. If GSSAPI authentication is required, it must be documented, to include the location of the configuration file, with the ISSO. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000364-GPOS-00151" tag gid: "V-72259" tag rid: "SV-86883r3_rule" tag stig_id: "RHEL-07-040430" tag fix_id: "F-78613r2_fix" tag cci: ["CCI-000318", "CCI-000368", "CCI-001812", "CCI-001813", "CCI-001814"] tag nist: ["CM-3 f", "CM-6 c", "CM-11 (2)", "CM-5 (1)", "CM-5 (1)", "Rev_4"] describe sshd_config do its('GSSAPIAuthentication') { should cmp 'no' } end end
Taking appropriate action when there is an error sending audit records to a remote system will minimize the possibility of losing audit records.
Test Results

Status skipped
Test Parse Config File /etc/audisp/audisp-remote.conf
Result
Result Details

Control V-73163
Title The Red Hat Enterprise Linux operating system must be configured so that the audit system takes appropriate action when there is an error sending audit records to a remote system.
Desc Taking appropriate action when there is an error sending audit records to a remote system will minimize the possibility of losing audit records.
Severity medium
Impact 0.5
Nist Controls AU-4 (1), Rev_4
Check Text Verify the action the operating system takes if there is an error sending audit records to a remote system. Check the action that takes place if there is an error sending audit records to a remote system with the following command: # grep -i network_failure_action /etc/audisp/audisp-remote.conf network_failure_action = syslog If the value of the "network_failure_action" option is not "syslog", "single", or "halt", or the line is commented out, this is a finding.
Fix Text Configure the action the operating system takes if there is an error sending audit records to a remote system. Uncomment the "network_failure_action" option in "/etc/audisp/audisp-remote.conf" and set it to "syslog", "single", or "halt". network_failure_action = syslog

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-73163" do title "The Red Hat Enterprise Linux operating system must be configured so that the audit system takes appropriate action when there is an error sending audit records to a remote system." desc "Taking appropriate action when there is an error sending audit records to a remote system will minimize the possibility of losing audit records." desc "rationale", "" desc "check", " Verify the action the operating system takes if there is an error sending audit records to a remote system. Check the action that takes place if there is an error sending audit records to a remote system with the following command: # grep -i network_failure_action /etc/audisp/audisp-remote.conf network_failure_action = syslog If the value of the \"network_failure_action\" option is not \"syslog\", \"single\", or \"halt\", or the line is commented out, this is a finding. " desc "fix", " Configure the action the operating system takes if there is an error sending audit records to a remote system. Uncomment the \"network_failure_action\" option in \"/etc/audisp/audisp-remote.conf\" and set it to \"syslog\", \"single\", or \"halt\". network_failure_action = syslog " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000342-GPOS-00133" tag gid: "V-73163" tag rid: "SV-87815r3_rule" tag stig_id: "RHEL-07-030321" tag fix_id: "F-79609r2_fix" tag cci: ["CCI-001851"] tag nist: ["AU-4 (1)", "Rev_4"] describe parse_config_file('/etc/audisp/audisp-remote.conf') do its('network_failure_action'.to_s) { should be_in ['syslog', 'single', 'halt'] } end end
ICMP redirect messages are used by routers to inform hosts that a more direct route exists for a particular destination. These messages modify the host's route table and are unauthenticated. An illicit ICMP redirect message could result in a man-in-the-middle attack.
Test Results

Status passed
Test Kernel Parameter net.ipv4.conf.default.accept_redirects value is expected to eq 0
Result
Result Details

Control V-72289
Title The Red Hat Enterprise Linux operating system must prevent Internet Protocol version 4 (IPv4) Internet Control Message Protocol (ICMP) redirect messages from being accepted.
Desc ICMP redirect messages are used by routers to inform hosts that a more direct route exists for a particular destination. These messages modify the host's route table and are unauthenticated. An illicit ICMP redirect message could result in a man-in-the-middle attack.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the system will not accept IPv4 ICMP redirect messages. # grep 'net.ipv4.conf.default.accept_redirects' /etc/sysctl.conf /etc/sysctl.d/* If " net.ipv4.conf.default.accept_redirects " is not configured in the /etc/sysctl.conf file or in the /etc/sysctl.d/ directory, is commented out, or does not have a value of "0", this is a finding. Check that the operating system implements the value of the "accept_redirects" variables with the following command: # /sbin/sysctl -a | grep 'net.ipv4.conf.default.accept_redirects' net.ipv4.conf.default.accept_redirects = 0 If the returned line does not have a value of "0", this is a finding.
Fix Text Set the system to not accept IPv4 ICMP redirect messages by adding the following line to "/etc/sysctl.conf" or a configuration file in the /etc/sysctl.d/ directory (or modify the line to have the required value): net.ipv4.conf.default.accept_redirects = 0 Issue the following command to make the changes take effect: # sysctl --system

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72289" do title "The Red Hat Enterprise Linux operating system must prevent Internet Protocol version 4 (IPv4) Internet Control Message Protocol (ICMP) redirect messages from being accepted." desc "ICMP redirect messages are used by routers to inform hosts that a more direct route exists for a particular destination. These messages modify the host's route table and are unauthenticated. An illicit ICMP redirect message could result in a man-in-the-middle attack." desc "rationale", "" desc "check", " Verify the system will not accept IPv4 ICMP redirect messages. # grep 'net.ipv4.conf.default.accept_redirects' /etc/sysctl.conf /etc/sysctl.d/* If \" net.ipv4.conf.default.accept_redirects \" is not configured in the /etc/sysctl.conf file or in the /etc/sysctl.d/ directory, is commented out, or does not have a value of \"0\", this is a finding. Check that the operating system implements the value of the \"accept_redirects\" variables with the following command: # /sbin/sysctl -a | grep 'net.ipv4.conf.default.accept_redirects' net.ipv4.conf.default.accept_redirects = 0 If the returned line does not have a value of \"0\", this is a finding. " desc "fix", " Set the system to not accept IPv4 ICMP redirect messages by adding the following line to \"/etc/sysctl.conf\" or a configuration file in the /etc/sysctl.d/ directory (or modify the line to have the required value): net.ipv4.conf.default.accept_redirects = 0 Issue the following command to make the changes take effect: # sysctl --system " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72289" tag rid: "SV-86913r3_rule" tag stig_id: "RHEL-07-040640" tag fix_id: "F-78643r3_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe kernel_parameter('net.ipv4.conf.default.accept_redirects') do its('value') { should eq 0 } end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with syscall == "fchown" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "fchown" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "fchown" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "fchown" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Result Details

Control V-72099
Title The Red Hat Enterprise Linux operating system must audit all uses of the fchown syscall.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-2 d, AU-12 c, Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "fchown" syscall occur. Check the file system rules in "/etc/audit/audit.rules" with the following commands: # grep -iw fchown /etc/audit/audit.rules -a always,exit -F arch=b32 -S fchown -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S fchown -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the "b32" and "b64" audit rules are not defined for the "fchown" syscall, this is a finding.
Fix Text Add or update the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S fchown -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S fchown -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72099" do title "The Red Hat Enterprise Linux operating system must audit all uses of the fchown syscall." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"fchown\" syscall occur. Check the file system rules in \"/etc/audit/audit.rules\" with the following commands: # grep -iw fchown /etc/audit/audit.rules -a always,exit -F arch=b32 -S fchown -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S fchown -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the \"b32\" and \"b64\" audit rules are not defined for the \"fchown\" syscall, this is a finding. " desc "fix", " Add or update the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S fchown -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S fchown -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000064-GPOS-00033" tag satisfies: ["SRG-OS-000064-GPOS-00033", "SRG-OS-000392-GPOS-00172", "SRG-OS-000458-GPOS-00203", "SRG-OS-000474-GPOS-00219"] tag gid: "V-72099" tag rid: "SV-86723r5_rule" tag stig_id: "RHEL-07-030380" tag fix_id: "F-78451r8_fix" tag cci: ["CCI-000126", "CCI-000172"] tag nist: ["AU-2 d", "AU-12 c", "Rev_4"] describe auditd.syscall("fchown").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end if os.arch == 'x86_64' describe auditd.syscall("fchown").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end end end
By limiting the number of failed logon attempts, the risk of unauthorized system access via user password guessing, otherwise known as brute-forcing, is reduced. Limits are imposed by locking the account.
Test Results

Status error
Test PAM Config[/etc/pam.d/password-auth] lines
Result undefined local variable or method `required_rules' for #<RSpec::ExampleGroups::PAMConfigEtcPamDPasswordAuth_2::Lines:0x00007fb47b50fc08> Did you mean? require_relative
Status passed
Test PAM Config[/etc/pam.d/password-auth] lines is expected to include auth [default=die]|required pam_faillock.so, all with arg deny <= 3
Result
Status passed
Test PAM Config[/etc/pam.d/password-auth] lines is expected to include auth [default=die]|required pam_faillock.so, all with arg fail_interval <= 900
Result
Status passed
Test PAM Config[/etc/pam.d/password-auth] lines is expected to include auth [default=die]|required pam_faillock.so, all with args unlock_time=(0|never) or include auth [default=die]|required pam_faillock.so, all with arg unlock_time <= 604800 and include auth [default=die]|required pam_faillock.so, all with arg unlock_time >= 604800
Result
Status error
Test PAM Config[/etc/pam.d/system-auth] lines
Result undefined local variable or method `required_rules' for #<RSpec::ExampleGroups::PAMConfigEtcPamDSystemAuth_2::Lines:0x00007fb47b5e4250> Did you mean? require_relative
Status passed
Test PAM Config[/etc/pam.d/system-auth] lines is expected to include auth [default=die]|required pam_faillock.so, all with arg deny <= 3
Result
Status passed
Test PAM Config[/etc/pam.d/system-auth] lines is expected to include auth [default=die]|required pam_faillock.so, all with arg fail_interval <= 900
Result
Status passed
Test PAM Config[/etc/pam.d/system-auth] lines is expected to include auth [default=die]|required pam_faillock.so, all with args unlock_time=(0|never) or include auth [default=die]|required pam_faillock.so, all with arg unlock_time <= 604800 and include auth [default=die]|required pam_faillock.so, all with arg unlock_time >= 604800
Result
Result Details

Control V-71943
Title The Red Hat Enterprise Linux operating system must be configured to lock accounts for a minimum of 15 minutes after three unsuccessful logon attempts within a 15-minute timeframe.
Desc By limiting the number of failed logon attempts, the risk of unauthorized system access via user password guessing, otherwise known as brute-forcing, is reduced. Limits are imposed by locking the account.
Severity medium
Impact 0.5
Nist Controls AC-7 a, AC-7 b, AC-7 b, AC-7 b, Rev_4
Check Text Check that the system locks an account for a minimum of 15 minutes after three unsuccessful logon attempts within a period of 15 minutes with the following command: # grep pam_faillock.so /etc/pam.d/password-auth auth required pam_faillock.so preauth silent audit deny=3 even_deny_root fail_interval=900 unlock_time=900 auth [default=die] pam_faillock.so authfail audit deny=3 even_deny_root fail_interval=900 unlock_time=900 account required pam_faillock.so If the "deny" parameter is set to "0" or a value less than "3" on both "auth" lines with the "pam_faillock.so" module, or is missing from these lines, this is a finding. If the "even_deny_root" parameter is not set on both "auth" lines with the "pam_faillock.so" module, or is missing from these lines, this is a finding. If the "fail_interval" parameter is set to "0" or is set to a value less than "900" on both "auth" lines with the "pam_faillock.so" module, or is missing from these lines, this is a finding. If the "unlock_time" parameter is not set to "0", "never", or is set to a value less than "900" on both "auth" lines with the "pam_faillock.so" module, or is missing from these lines, this is a finding. Note: The maximum configurable value for "unlock_time" is "604800". If any line referencing the "pam_faillock.so" module is commented out, this is a finding. # grep pam_faillock.so /etc/pam.d/system-auth auth required pam_faillock.so preauth silent audit deny=3 even_deny_root fail_interval=900 unlock_time=900 auth [default=die] pam_faillock.so authfail audit deny=3 even_deny_root fail_interval=900 unlock_time=900 account required pam_faillock.so If the "deny" parameter is set to "0" or a value less than "3" on both "auth" lines with the "pam_faillock.so" module, or is missing from these lines, this is a finding. If the "even_deny_root" parameter is not set on both "auth" lines with the "pam_faillock.so" module, or is missing from these lines, this is a finding. If the "fail_interval" parameter is set to "0" or is set to a value less than "900" on both "auth" lines with the "pam_faillock.so" module, or is missing from these lines, this is a finding. If the "unlock_time" parameter is not set to "0", "never", or is set to a value less than "900" on both "auth" lines with the "pam_faillock.so" module or is missing from these lines, this is a finding. Note: The maximum configurable value for "unlock_time" is "604800". If any line referencing the "pam_faillock.so" module is commented out, this is a finding.
Fix Text Configure the operating system to lock an account for the maximum period when three unsuccessful logon attempts in 15 minutes are made. Modify the first three lines of the auth section and the first line of the account section of the "/etc/pam.d/system-auth" and "/etc/pam.d/password-auth" files to match the following lines: auth required pam_faillock.so preauth silent audit deny=3 even_deny_root fail_interval=900 unlock_time=900 auth sufficient pam_unix.so try_first_pass auth [default=die] pam_faillock.so authfail audit deny=3 even_deny_root fail_interval=900 unlock_time=900 account required pam_faillock.so Note: Manual changes to the listed files may be overwritten by the "authconfig" program. The "authconfig" program should not be used to update the configurations listed in this requirement.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71943" do title "The Red Hat Enterprise Linux operating system must be configured to lock accounts for a minimum of 15 minutes after three unsuccessful logon attempts within a 15-minute timeframe." desc "By limiting the number of failed logon attempts, the risk of unauthorized system access via user password guessing, otherwise known as brute-forcing, is reduced. Limits are imposed by locking the account. " desc "rationale", "" desc "check", " Check that the system locks an account for a minimum of 15 minutes after three unsuccessful logon attempts within a period of 15 minutes with the following command: # grep pam_faillock.so /etc/pam.d/password-auth auth required pam_faillock.so preauth silent audit deny=3 even_deny_root fail_interval=900 unlock_time=900 auth [default=die] pam_faillock.so authfail audit deny=3 even_deny_root fail_interval=900 unlock_time=900 account required pam_faillock.so If the \"deny\" parameter is set to \"0\" or a value less than \"3\" on both \"auth\" lines with the \"pam_faillock.so\" module, or is missing from these lines, this is a finding. If the \"even_deny_root\" parameter is not set on both \"auth\" lines with the \"pam_faillock.so\" module, or is missing from these lines, this is a finding. If the \"fail_interval\" parameter is set to \"0\" or is set to a value less than \"900\" on both \"auth\" lines with the \"pam_faillock.so\" module, or is missing from these lines, this is a finding. If the \"unlock_time\" parameter is not set to \"0\", \"never\", or is set to a value less than \"900\" on both \"auth\" lines with the \"pam_faillock.so\" module, or is missing from these lines, this is a finding. Note: The maximum configurable value for \"unlock_time\" is \"604800\". If any line referencing the \"pam_faillock.so\" module is commented out, this is a finding. # grep pam_faillock.so /etc/pam.d/system-auth auth required pam_faillock.so preauth silent audit deny=3 even_deny_root fail_interval=900 unlock_time=900 auth [default=die] pam_faillock.so authfail audit deny=3 even_deny_root fail_interval=900 unlock_time=900 account required pam_faillock.so If the \"deny\" parameter is set to \"0\" or a value less than \"3\" on both \"auth\" lines with the \"pam_faillock.so\" module, or is missing from these lines, this is a finding. If the \"even_deny_root\" parameter is not set on both \"auth\" lines with the \"pam_faillock.so\" module, or is missing from these lines, this is a finding. If the \"fail_interval\" parameter is set to \"0\" or is set to a value less than \"900\" on both \"auth\" lines with the \"pam_faillock.so\" module, or is missing from these lines, this is a finding. If the \"unlock_time\" parameter is not set to \"0\", \"never\", or is set to a value less than \"900\" on both \"auth\" lines with the \"pam_faillock.so\" module or is missing from these lines, this is a finding. Note: The maximum configurable value for \"unlock_time\" is \"604800\". If any line referencing the \"pam_faillock.so\" module is commented out, this is a finding. " desc "fix", " Configure the operating system to lock an account for the maximum period when three unsuccessful logon attempts in 15 minutes are made. Modify the first three lines of the auth section and the first line of the account section of the \"/etc/pam.d/system-auth\" and \"/etc/pam.d/password-auth\" files to match the following lines: auth required pam_faillock.so preauth silent audit deny=3 even_deny_root fail_interval=900 unlock_time=900 auth sufficient pam_unix.so try_first_pass auth [default=die] pam_faillock.so authfail audit deny=3 even_deny_root fail_interval=900 unlock_time=900 account required pam_faillock.so Note: Manual changes to the listed files may be overwritten by the \"authconfig\" program. The \"authconfig\" program should not be used to update the configurations listed in this requirement. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000329-GPOS-00128" tag satisfies: ["SRG-OS-000329-GPOS-00128", "SRG-OS-000021-GPOS-00005"] tag gid: "V-71943" tag rid: "SV-86567r5_rule" tag stig_id: "RHEL-07-010320" tag fix_id: "F-78295r5_fix" tag cci: ["CCI-000044", "CCI-002236", "CCI-002237", "CCI-002238"] tag nist: ["AC-7 a", "AC-7 b", "AC-7 b", "AC-7 b", "Rev_4"] unsuccessful_attempts = input('unsuccessful_attempts') fail_interval = input('fail_interval') lockout_time = input('lockout_time') describe pam('/etc/pam.d/password-auth') do its('lines') { should match_pam_rules(required_rules).exactly.or \ match_pam_rules(alternate_rules).exactly } its('lines') { should match_pam_rule('auth [default=die]|required pam_faillock.so').all_with_integer_arg('deny', '<=', unsuccessful_attempts) } its('lines') { should match_pam_rule('auth [default=die]|required pam_faillock.so').all_with_integer_arg('fail_interval', '<=', fail_interval) } its('lines') { should match_pam_rule('auth [default=die]|required pam_faillock.so').all_with_args('unlock_time=(0|never)').or \ (match_pam_rule('auth [default=die]|required pam_faillock.so').all_with_integer_arg('unlock_time', '<=', 604800).and \ match_pam_rule('auth [default=die]|required pam_faillock.so').all_with_integer_arg('unlock_time', '>=', lockout_time)) } end describe pam('/etc/pam.d/system-auth') do its('lines') { should match_pam_rules(required_rules).exactly.or \ match_pam_rules(alternate_rules).exactly } its('lines') { should match_pam_rule('auth [default=die]|required pam_faillock.so').all_with_integer_arg('deny', '<=', unsuccessful_attempts) } its('lines') { should match_pam_rule('auth [default=die]|required pam_faillock.so').all_with_integer_arg('fail_interval', '<=', fail_interval) } its('lines') { should match_pam_rule('auth [default=die]|required pam_faillock.so').all_with_args('unlock_time=(0|never)').or \ (match_pam_rule('auth [default=die]|required pam_faillock.so').all_with_integer_arg('unlock_time', '<=', 604800).and \ match_pam_rule('auth [default=die]|required pam_faillock.so').all_with_integer_arg('unlock_time', '>=', lockout_time)) } end end
A session time-out lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not log out because of the temporary nature of the absence. Rather than relying on the user to manually lock their operating system session prior to vacating the vicinity, operating systems need to be able to identify when a user's session has idled and take action to initiate the session lock. The session lock is implemented at the point where session activity can be determined and/or controlled.
Test Results

Status skipped
Test The GNOME desktop is not installed
Result
Result Details

Control V-73155
Title The Red Hat Enterprise Linux operating system must prevent a user from overriding the screensaver lock-delay setting for the graphical user interface.
Desc A session time-out lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not log out because of the temporary nature of the absence. Rather than relying on the user to manually lock their operating system session prior to vacating the vicinity, operating systems need to be able to identify when a user's session has idled and take action to initiate the session lock. The session lock is implemented at the point where session activity can be determined and/or controlled.
Severity none
Nist Controls AC-11 a, Rev_4
Check Text Verify the operating system prevents a user from overriding a screensaver lock after a 15-minute period of inactivity for graphical user interfaces. Note: If the system does not have GNOME installed, this requirement is Not Applicable. The screen program must be installed to lock sessions on the console. Determine which profile the system database is using with the following command: # grep system-db /etc/dconf/profile/user system-db:local Check for the lock delay setting with the following command: Note: The example below is using the database "local" for the system, so the path is "/etc/dconf/db/local.d". This path must be modified if a database other than "local" is being used. # grep -i lock-delay /etc/dconf/db/local.d/locks/* /org/gnome/desktop/screensaver/lock-delay If the command does not return a result, this is a finding.
Fix Text Configure the operating system to prevent a user from overriding a screensaver lock after a 15-minute period of inactivity for graphical user interfaces. Create a database to contain the system-wide screensaver settings (if it does not already exist) with the following command: Note: The example below is using the database "local" for the system, so if the system is using another database in "/etc/dconf/profile/user", the file should be created under the appropriate subdirectory. # touch /etc/dconf/db/local.d/locks/session Add the setting to lock the screensaver lock delay: /org/gnome/desktop/screensaver/lock-delay

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-73155" do title "The Red Hat Enterprise Linux operating system must prevent a user from overriding the screensaver lock-delay setting for the graphical user interface." desc "A session time-out lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not log out because of the temporary nature of the absence. Rather than relying on the user to manually lock their operating system session prior to vacating the vicinity, operating systems need to be able to identify when a user's session has idled and take action to initiate the session lock. The session lock is implemented at the point where session activity can be determined and/or controlled. " desc "rationale", "" desc "check", " Verify the operating system prevents a user from overriding a screensaver lock after a 15-minute period of inactivity for graphical user interfaces. Note: If the system does not have GNOME installed, this requirement is Not Applicable. The screen program must be installed to lock sessions on the console. Determine which profile the system database is using with the following command: # grep system-db /etc/dconf/profile/user system-db:local Check for the lock delay setting with the following command: Note: The example below is using the database \"local\" for the system, so the path is \"/etc/dconf/db/local.d\". This path must be modified if a database other than \"local\" is being used. # grep -i lock-delay /etc/dconf/db/local.d/locks/* /org/gnome/desktop/screensaver/lock-delay If the command does not return a result, this is a finding. " desc "fix", " Configure the operating system to prevent a user from overriding a screensaver lock after a 15-minute period of inactivity for graphical user interfaces. Create a database to contain the system-wide screensaver settings (if it does not already exist) with the following command: Note: The example below is using the database \"local\" for the system, so if the system is using another database in \"/etc/dconf/profile/user\", the file should be created under the appropriate subdirectory. # touch /etc/dconf/db/local.d/locks/session Add the setting to lock the screensaver lock delay: /org/gnome/desktop/screensaver/lock-delay " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000029-GPOS-00010" tag gid: "V-73155" tag rid: "SV-87807r4_rule" tag stig_id: "RHEL-07-010081" tag fix_id: "F-79601r2_fix" tag cci: ["CCI-000057"] tag nist: ["AC-11 a", "Rev_4"] unless package('gnome-desktop3').installed? impact 0.0 describe "The GNOME desktop is not installed" do skip "The GNOME desktop is not installed, this control is Not Applicable." end else describe command("gsettings writable org.gnome.desktop.screensaver lock-delay") do its('stdout.strip') { should cmp 'false' } end end end
Without cryptographic integrity protections, information can be altered by unauthorized users without detection. Cryptographic mechanisms used for protecting the integrity of information include, for example, signed hash functions using asymmetric cryptography enabling distribution of the public key to verify the hash information while maintaining the confidentiality of the key used to generate the hash.
Test Results

Status skipped
Test LDAP not enabled
Result
Result Details

Control V-72227
Title The Red Hat Enterprise Linux operating system must implement cryptography to protect the integrity of Lightweight Directory Access Protocol (LDAP) authentication communications.
Desc Without cryptographic integrity protections, information can be altered by unauthorized users without detection. Cryptographic mechanisms used for protecting the integrity of information include, for example, signed hash functions using asymmetric cryptography enabling distribution of the public key to verify the hash information while maintaining the confidentiality of the key used to generate the hash.
Severity none
Nist Controls AC-17 (2), Rev_4
Check Text If LDAP is not being utilized, this requirement is Not Applicable. Verify the operating system implements cryptography to protect the integrity of remote LDAP authentication sessions. To determine if LDAP is being used for authentication, use the following command: # systemctl status sssd.service sssd.service - System Security Services Daemon Loaded: loaded (/usr/lib/systemd/system/sssd.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2018-06-27 10:58:11 EST; 1h 50min ago If the "sssd.service" is "active", then LDAP is being used. Determine the "id_provider" the LDAP is currently using: # grep -i "id_provider" /etc/sssd/sssd.conf id_provider = ad If "id_provider" is set to "ad", this is Not Applicable. Ensure that LDAP is configured to use TLS by using the following command: # grep -i "start_tls" /etc/sssd/sssd.conf ldap_id_use_start_tls = true If the "ldap_id_use_start_tls" option is not "true", this is a finding.
Fix Text Configure the operating system to implement cryptography to protect the integrity of LDAP authentication sessions. Add or modify the following line in "/etc/sssd/sssd.conf": ldap_id_use_start_tls = true

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72227" do title "The Red Hat Enterprise Linux operating system must implement cryptography to protect the integrity of Lightweight Directory Access Protocol (LDAP) authentication communications." desc "Without cryptographic integrity protections, information can be altered by unauthorized users without detection. Cryptographic mechanisms used for protecting the integrity of information include, for example, signed hash functions using asymmetric cryptography enabling distribution of the public key to verify the hash information while maintaining the confidentiality of the key used to generate the hash. " desc "rationale", "" desc "check", " If LDAP is not being utilized, this requirement is Not Applicable. Verify the operating system implements cryptography to protect the integrity of remote LDAP authentication sessions. To determine if LDAP is being used for authentication, use the following command: # systemctl status sssd.service sssd.service - System Security Services Daemon Loaded: loaded (/usr/lib/systemd/system/sssd.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2018-06-27 10:58:11 EST; 1h 50min ago If the \"sssd.service\" is \"active\", then LDAP is being used. Determine the \"id_provider\" the LDAP is currently using: # grep -i \"id_provider\" /etc/sssd/sssd.conf id_provider = ad If \"id_provider\" is set to \"ad\", this is Not Applicable. Ensure that LDAP is configured to use TLS by using the following command: # grep -i \"start_tls\" /etc/sssd/sssd.conf ldap_id_use_start_tls = true If the \"ldap_id_use_start_tls\" option is not \"true\", this is a finding. " desc "fix", " Configure the operating system to implement cryptography to protect the integrity of LDAP authentication sessions. Add or modify the following line in \"/etc/sssd/sssd.conf\": ldap_id_use_start_tls = true " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000250-GPOS-00093" tag gid: "V-72227" tag rid: "SV-86851r4_rule" tag stig_id: "RHEL-07-040180" tag fix_id: "F-78581r2_fix" tag cci: ["CCI-001453"] tag nist: ["AC-17 (2)", "Rev_4"] sssd_id_ldap_enabled = (package('sssd').installed? and !command('grep "^\s*id_provider\s*=\s*ldap" /etc/sssd/sssd.conf').stdout.strip.empty?) pam_ldap_enabled = (!command('grep "^[^#]*pam_ldap\.so" /etc/pam.d/*').stdout.strip.empty?) if !(sssd_id_ldap_enabled or pam_ldap_enabled) impact 0.0 describe "LDAP not enabled" do skip "LDAP not enabled using any known mechanisms, this control is Not Applicable." end end if sssd_id_ldap_enabled ldap_id_use_start_tls = command('grep ldap_id_use_start_tls /etc/sssd/sssd.conf') describe ldap_id_use_start_tls do its('stdout.strip') { should match %r{^ldap_id_use_start_tls\s*=\s*true$}} end ldap_id_use_start_tls.stdout.strip.each_line do |line| describe line do it { should match %r{^ldap_id_use_start_tls\s*=\s*true$}} end end end if pam_ldap_enabled describe command('grep -i ssl /etc/pam_ldap.conf') do its('stdout.strip') { should match %r{^ssl start_tls$}} end end end
IP tunneling mechanisms can be used to bypass network filtering. If tunneling is required, it must be documented with the Information System Security Officer (ISSO).
Test Results

Status skipped
Test The system does not have libreswan installed or the ipsec.service isn't running
Result
Result Details

Control V-72317
Title The Red Hat Enterprise Linux operating system must not have unauthorized IP tunnels configured.
Desc IP tunneling mechanisms can be used to bypass network filtering. If tunneling is required, it must be documented with the Information System Security Officer (ISSO).
Severity none
Nist Controls CM-6 b, Rev_4
Check Text Verify the system does not have unauthorized IP tunnels configured. Check to see if "libreswan" is installed with the following command: # yum list installed libreswan libreswan.x86-64 3.20-5.el7_4 If "libreswan" is installed, check to see if the "IPsec" service is active with the following command: # systemctl status ipsec ipsec.service - Internet Key Exchange (IKE) Protocol Daemon for IPsec Loaded: loaded (/usr/lib/systemd/system/ipsec.service; disabled) Active: inactive (dead) If the "IPsec" service is active, check to see if any tunnels are configured in "/etc/ipsec.conf" and "/etc/ipsec.d/" with the following commands: # grep -iw conn /etc/ipsec.conf /etc/ipsec.d/*.conf If there are indications that a "conn" parameter is configured for a tunnel, ask the System Administrator if the tunnel is documented with the ISSO. If "libreswan" is installed, "IPsec" is active, and an undocumented tunnel is active, this is a finding.
Fix Text Remove all unapproved tunnels from the system, or document them with the ISSO.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72317" do title "The Red Hat Enterprise Linux operating system must not have unauthorized IP tunnels configured." desc "IP tunneling mechanisms can be used to bypass network filtering. If tunneling is required, it must be documented with the Information System Security Officer (ISSO)." desc "rationale", "" desc "check", " Verify the system does not have unauthorized IP tunnels configured. Check to see if \"libreswan\" is installed with the following command: # yum list installed libreswan libreswan.x86-64 3.20-5.el7_4 If \"libreswan\" is installed, check to see if the \"IPsec\" service is active with the following command: # systemctl status ipsec ipsec.service - Internet Key Exchange (IKE) Protocol Daemon for IPsec Loaded: loaded (/usr/lib/systemd/system/ipsec.service; disabled) Active: inactive (dead) If the \"IPsec\" service is active, check to see if any tunnels are configured in \"/etc/ipsec.conf\" and \"/etc/ipsec.d/\" with the following commands: # grep -iw conn /etc/ipsec.conf /etc/ipsec.d/*.conf If there are indications that a \"conn\" parameter is configured for a tunnel, ask the System Administrator if the tunnel is documented with the ISSO. If \"libreswan\" is installed, \"IPsec\" is active, and an undocumented tunnel is active, this is a finding. " desc "fix", "Remove all unapproved tunnels from the system, or document them with the ISSO." tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72317" tag rid: "SV-86941r2_rule" tag stig_id: "RHEL-07-040820" tag fix_id: "F-78671r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] approved_tunnels = input('approved_tunnels') if package('libreswan').installed? && service('ipsec.service').running? impact 0.5 processed = [] to_process = ['/etc/ipsec.conf'] while !to_process.empty? in_process = to_process.pop next if processed.include? in_process processed.push in_process to_process.concat( command("grep -E '^\\s*include\\s+' #{in_process} | sed 's/^[[:space:]]*include[[:space:]]*//g'"). stdout.strip.split(%r{\s*\n+\s*}). map { |f| f.start_with?('/') ? f : File.join(File.dirname(in_process), f) }. map { |f| dir = f.sub(%r{[^/]*[\*\?\[].*$}, '') # gets the longest ancestor path which doesn't contain wildcards command("find #{dir} -wholename '#{f}'").stdout.strip.split("\n") }. flatten. select { |f| file(f).file? } ) end conn_grep = processed.map do |conf| command("grep -E '^\\s*conn\\s+' #{conf}"). stdout.strip.split(%r{\s*\n\s*}) end.flatten describe conn_grep do it { should all(be_in approved_tunnels) } end else impact 0.0 describe "The system does not have libreswan installed or the ipsec.service isn't running" do skip "The system does not have libreswan installed or the ipsec.service isn't running, this requirement is Not Applicable." end end end
If an account has an empty password, anyone could log on and run commands with the privileges of that account. Accounts with empty passwords should never be used in operational environments.
Test Results

Status passed
Test PAM Config[/etc/pam.d/config-util] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/other] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/passwd] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/chfn] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/chsh] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/login] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/remote] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/runuser] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/runuser-l] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/su] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/su-l] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/systemd-user] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/polkit-1] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/crond] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/rhn_register] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/subscription-manager] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/sshd] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/smtp.postfix] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/smtp] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/vlock] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/sudo] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/sudo-i] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/fingerprint-auth] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/smartcard-auth] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/atd] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/sssd-shadowutils] lines is expected to include .* .* pam_unix.so, all without args nullok
Result expected "auth [success=done ignore=ignore default=die] pam_unix.so nullok try_first_pass\naccount required pam_unix.so" to include .* .* pam_unix.so, all without args nullok Diff: @@ -1,2 +1,3 @@ -.* .* pam_unix.so +auth [success=done ignore=ignore default=die] pam_unix.so nullok try_first_pass +account required pam_unix.so
Status passed
Test PAM Config[/etc/pam.d/screen] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/system-auth-local] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/system-auth] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/password-auth-local] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/password-auth] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Status passed
Test PAM Config[/etc/pam.d/postlogin] lines is expected to include .* .* pam_unix.so, all without args nullok
Result
Result Details

Control V-71937
Title The Red Hat Enterprise Linux operating system must not have accounts configured with blank or null passwords.
Desc If an account has an empty password, anyone could log on and run commands with the privileges of that account. Accounts with empty passwords should never be used in operational environments.
Severity high
Impact 0.7
Nist Controls CM-6 b, Rev_4
Check Text To verify that null passwords cannot be used, run the following command: # grep nullok /etc/pam.d/system-auth /etc/pam.d/password-auth If this produces any output, it may be possible to log on with accounts with empty passwords. If null passwords can be used, this is a finding.
Fix Text If an account is configured for password authentication but does not have an assigned password, it may be possible to log on to the account without authenticating. Remove any instances of the "nullok" option in "/etc/pam.d/system-auth" and "/etc/pam.d/password-auth" to prevent logons with empty passwords. Note: Manual changes to the listed files may be overwritten by the "authconfig" program. The "authconfig" program should not be used to update the configurations listed in this requirement.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71937" do title "The Red Hat Enterprise Linux operating system must not have accounts configured with blank or null passwords." desc "If an account has an empty password, anyone could log on and run commands with the privileges of that account. Accounts with empty passwords should never be used in operational environments." desc "rationale", "" desc "check", " To verify that null passwords cannot be used, run the following command: # grep nullok /etc/pam.d/system-auth /etc/pam.d/password-auth If this produces any output, it may be possible to log on with accounts with empty passwords. If null passwords can be used, this is a finding. " desc "fix", " If an account is configured for password authentication but does not have an assigned password, it may be possible to log on to the account without authenticating. Remove any instances of the \"nullok\" option in \"/etc/pam.d/system-auth\" and \"/etc/pam.d/password-auth\" to prevent logons with empty passwords. Note: Manual changes to the listed files may be overwritten by the \"authconfig\" program. The \"authconfig\" program should not be used to update the configurations listed in this requirement. " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-71937" tag rid: "SV-86561r3_rule" tag stig_id: "RHEL-07-010290" tag fix_id: "F-78289r3_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] # Fetch all files under /etc/pam.d excluding '*-ac' files # but including symlinks pam_file_list = command('find /etc/pam.d ! -name \'*-ac\' -a \( -type f -o -type l \)').stdout.strip.split pam_file_list.each do |pam_file| describe pam(pam_file) do its('lines') { should match_pam_rule('.* .* pam_unix.so').all_without_args('nullok') } end end end
A session lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not want to log out because of the temporary nature of the absence. The session lock is implemented at the point where session activity can be determined. The ability to enable/disable a session lock is given to the user by default. Disabling the user’s ability to disengage the graphical user interface session lock provides the assurance that all sessions will lock after the specified period of time.
Test Results

Status skipped
Test The GNOME desktop is not installed
Result
Result Details

Control V-78995
Title The Red Hat Enterprise Linux operating system must prevent a user from overriding the screensaver lock-enabled setting for the graphical user interface.
Desc A session lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not want to log out because of the temporary nature of the absence. The session lock is implemented at the point where session activity can be determined. The ability to enable/disable a session lock is given to the user by default. Disabling the user’s ability to disengage the graphical user interface session lock provides the assurance that all sessions will lock after the specified period of time.
Severity none
Nist Controls AC-11 a, Rev_4
Check Text Verify the operating system prevents a user from overriding the screensaver lock-enabled setting for the graphical user interface. Note: If the system does not have GNOME installed, this requirement is Not Applicable. The screen program must be installed to lock sessions on the console. Determine which profile the system database is using with the following command: # grep system-db /etc/dconf/profile/user system-db:local Check for the lock-enabled setting with the following command: Note: The example below is using the database "local" for the system, so the path is "/etc/dconf/db/local.d". This path must be modified if a database other than "local" is being used. # grep -i lock-enabled /etc/dconf/db/local.d/locks/* /org/gnome/desktop/screensaver/lock-enabled If the command does not return a result, this is a finding.
Fix Text Configure the operating system to prevent a user from overriding a screensaver lock after a 15-minute period of inactivity for graphical user interfaces. Create a database to contain the system-wide screensaver settings (if it does not already exist) with the following command: Note: The example below is using the database "local" for the system, so if the system is using another database in "/etc/dconf/profile/user", the file should be created under the appropriate subdirectory. # touch /etc/dconf/db/local.d/locks/session Add the setting to lock the screensaver lock-enabled setting: /org/gnome/desktop/screensaver/lock-enabled

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-78995" do title "The Red Hat Enterprise Linux operating system must prevent a user from overriding the screensaver lock-enabled setting for the graphical user interface." desc "A session lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not want to log out because of the temporary nature of the absence. The session lock is implemented at the point where session activity can be determined. The ability to enable/disable a session lock is given to the user by default. Disabling the user’s ability to disengage the graphical user interface session lock provides the assurance that all sessions will lock after the specified period of time. " desc "rationale", "" desc "check", " Verify the operating system prevents a user from overriding the screensaver lock-enabled setting for the graphical user interface. Note: If the system does not have GNOME installed, this requirement is Not Applicable. The screen program must be installed to lock sessions on the console. Determine which profile the system database is using with the following command: # grep system-db /etc/dconf/profile/user system-db:local Check for the lock-enabled setting with the following command: Note: The example below is using the database \"local\" for the system, so the path is \"/etc/dconf/db/local.d\". This path must be modified if a database other than \"local\" is being used. # grep -i lock-enabled /etc/dconf/db/local.d/locks/* /org/gnome/desktop/screensaver/lock-enabled If the command does not return a result, this is a finding. " desc "fix", " Configure the operating system to prevent a user from overriding a screensaver lock after a 15-minute period of inactivity for graphical user interfaces. Create a database to contain the system-wide screensaver settings (if it does not already exist) with the following command: Note: The example below is using the database \"local\" for the system, so if the system is using another database in \"/etc/dconf/profile/user\", the file should be created under the appropriate subdirectory. # touch /etc/dconf/db/local.d/locks/session Add the setting to lock the screensaver lock-enabled setting: /org/gnome/desktop/screensaver/lock-enabled " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000029-GPOS-00010" tag gid: "V-78995" tag rid: "SV-93701r3_rule" tag stig_id: "RHEL-07-010062" tag fix_id: "F-85745r1_fix" tag cci: ["CCI-000057"] tag nist: ["AC-11 a", "Rev_4"] if package('gnome-desktop3').installed? describe command("gsettings writable org.gnome.desktop.screensaver lock-enabled") do its('stdout.strip') { should cmp 'false' } end else impact 0.0 describe "The GNOME desktop is not installed" do skip "The GNOME desktop is not installed, this control is Not Applicable." end end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with file == "/usr/sbin/setsebool" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/usr/sbin/setsebool" action is expected not to include "never"
Result
Status passed
Test ["x"] is expected to include "x"
Result
Result Details

Control V-72137
Title The Red Hat Enterprise Linux operating system must audit all uses of the setsebool command.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "setsebool" command occur. Check the file system rule in "/etc/audit/audit.rules" with the following command: # grep -i /usr/sbin/setsebool /etc/audit/audit.rules -a always,exit -F path=/usr/sbin/setsebool -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change If the command does not return any output, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "setsebool" command occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules": -a always,exit -F path=/usr/sbin/setsebool -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72137" do title "The Red Hat Enterprise Linux operating system must audit all uses of the setsebool command." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"setsebool\" command occur. Check the file system rule in \"/etc/audit/audit.rules\" with the following command: # grep -i /usr/sbin/setsebool /etc/audit/audit.rules -a always,exit -F path=/usr/sbin/setsebool -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change If the command does not return any output, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"setsebool\" command occur. Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F path=/usr/sbin/setsebool -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000392-GPOS-00172" tag satisfies: ["SRG-OS-000392-GPOS-00172", "SRG-OS-000463-GPOS-00207", "SRG-OS-000465-GPOS-00209"] tag gid: "V-72137" tag rid: "SV-86761r4_rule" tag stig_id: "RHEL-07-030570" tag fix_id: "F-78489r6_fix" tag cci: ["CCI-000172", "CCI-002884"] tag nist: ["AU-12 c", "MA-4 (1) (a)", "Rev_4"] audit_file = '/usr/sbin/setsebool' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'x' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
Files without a valid group owner may be unintentionally inherited if a group is assigned the same Group Identifier (GID) as the GID of the files without a valid group owner.
Test Results

Status passed
Test Command: `find / -xautofs -fstype xfs -nogroup` stdout.strip is expected to be empty
Result
Status passed
Test Command: `find / -xautofs -fstype ext3 -nogroup` stdout.strip is expected to be empty
Result
Status passed
Test Command: `find / -xautofs -fstype ext2 -nogroup` stdout.strip is expected to be empty
Result
Status passed
Test Command: `find / -xautofs -fstype ext4 -nogroup` stdout.strip is expected to be empty
Result
Status passed
Test Command: `find / -xautofs -fstype msdos -nogroup` stdout.strip is expected to be empty
Result
Status passed
Test Command: `find / -xautofs -fstype vfat -nogroup` stdout.strip is expected to be empty
Result
Status passed
Test Command: `find / -xautofs -fstype btrfs -nogroup` stdout.strip is expected to be empty
Result
Status passed
Test Command: `find / -xautofs -fstype fuseblk -nogroup` stdout.strip is expected to be empty
Result
Result Details

Control V-72009
Title The Red Hat Enterprise Linux operating system must be configured so that all files and directories have a valid group owner.
Desc Files without a valid group owner may be unintentionally inherited if a group is assigned the same Group Identifier (GID) as the GID of the files without a valid group owner.
Severity medium
Impact 0.5
Nist Controls AC-3 (4), Rev_4
Check Text Verify all files and directories on the system have a valid group. Check the owner of all files and directories with the following command: Note: The value after -fstype must be replaced with the filesystem type. XFS is used as an example. # find / -fstype xfs -nogroup If any files on the system do not have an assigned group, this is a finding.
Fix Text Either remove all files and directories from the system that do not have a valid group, or assign a valid group to all files and directories on the system with the "chgrp" command: # chgrp <group> <file>

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72009" do title "The Red Hat Enterprise Linux operating system must be configured so that all files and directories have a valid group owner." desc "Files without a valid group owner may be unintentionally inherited if a group is assigned the same Group Identifier (GID) as the GID of the files without a valid group owner." desc "rationale", "" desc "check", " Verify all files and directories on the system have a valid group. Check the owner of all files and directories with the following command: Note: The value after -fstype must be replaced with the filesystem type. XFS is used as an example. # find / -fstype xfs -nogroup If any files on the system do not have an assigned group, this is a finding. " desc "fix", " Either remove all files and directories from the system that do not have a valid group, or assign a valid group to all files and directories on the system with the \"chgrp\" command: # chgrp <group> <file> " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72009" tag rid: "SV-86633r3_rule" tag stig_id: "RHEL-07-020330" tag fix_id: "F-78361r1_fix" tag cci: ["CCI-002165"] tag nist: ["AC-3 (4)", "Rev_4"] command('grep -v "nodev" /proc/filesystems | awk \'NF{ print $NF }\''). stdout.strip.split("\n").each do |fs| describe command("find / -xautofs -fstype #{fs} -nogroup") do its('stdout.strip') { should be_empty } end end end
A session time-out lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not log out because of the temporary nature of the absence. Rather than relying on the user to manually lock their operating system session prior to vacating the vicinity, operating systems need to be able to identify when a user's session has idled and take action to initiate the session lock. The session lock is implemented at the point where session activity can be determined and/or controlled.
Test Results

Status skipped
Test The GNOME desktop is not installed
Result
Result Details

Control V-73157
Title The Red Hat Enterprise Linux operating system must prevent a user from overriding the session idle-delay setting for the graphical user interface.
Desc A session time-out lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not log out because of the temporary nature of the absence. Rather than relying on the user to manually lock their operating system session prior to vacating the vicinity, operating systems need to be able to identify when a user's session has idled and take action to initiate the session lock. The session lock is implemented at the point where session activity can be determined and/or controlled.
Severity none
Nist Controls AC-11 a, Rev_4
Check Text Verify the operating system prevents a user from overriding session idle delay after a 15-minute period of inactivity for graphical user interfaces. Note: If the system does not have GNOME installed, this requirement is Not Applicable. The screen program must be installed to lock sessions on the console. Determine which profile the system database is using with the following command: # grep system-db /etc/dconf/profile/user system-db:local Check for the session idle delay setting with the following command: Note: The example below is using the database "local" for the system, so the path is "/etc/dconf/db/local.d". This path must be modified if a database other than "local" is being used. # grep -i idle-delay /etc/dconf/db/local.d/locks/* /org/gnome/desktop/session/idle-delay If the command does not return a result, this is a finding.
Fix Text Configure the operating system to prevent a user from overriding a session lock after a 15-minute period of inactivity for graphical user interfaces. Create a database to contain the system-wide screensaver settings (if it does not already exist) with the following command: Note: The example below is using the database "local" for the system, so if the system is using another database in /etc/dconf/profile/user, the file should be created under the appropriate subdirectory. # touch /etc/dconf/db/local.d/locks/session Add the setting to lock the session idle delay: /org/gnome/desktop/session/idle-delay

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-73157" do title "The Red Hat Enterprise Linux operating system must prevent a user from overriding the session idle-delay setting for the graphical user interface." desc "A session time-out lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not log out because of the temporary nature of the absence. Rather than relying on the user to manually lock their operating system session prior to vacating the vicinity, operating systems need to be able to identify when a user's session has idled and take action to initiate the session lock. The session lock is implemented at the point where session activity can be determined and/or controlled. " desc "rationale", "" desc "check", " Verify the operating system prevents a user from overriding session idle delay after a 15-minute period of inactivity for graphical user interfaces. Note: If the system does not have GNOME installed, this requirement is Not Applicable. The screen program must be installed to lock sessions on the console. Determine which profile the system database is using with the following command: # grep system-db /etc/dconf/profile/user system-db:local Check for the session idle delay setting with the following command: Note: The example below is using the database \"local\" for the system, so the path is \"/etc/dconf/db/local.d\". This path must be modified if a database other than \"local\" is being used. # grep -i idle-delay /etc/dconf/db/local.d/locks/* /org/gnome/desktop/session/idle-delay If the command does not return a result, this is a finding. " desc "fix", " Configure the operating system to prevent a user from overriding a session lock after a 15-minute period of inactivity for graphical user interfaces. Create a database to contain the system-wide screensaver settings (if it does not already exist) with the following command: Note: The example below is using the database \"local\" for the system, so if the system is using another database in /etc/dconf/profile/user, the file should be created under the appropriate subdirectory. # touch /etc/dconf/db/local.d/locks/session Add the setting to lock the session idle delay: /org/gnome/desktop/session/idle-delay " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000029-GPOS-00010" tag gid: "V-73157" tag rid: "SV-87809r4_rule" tag stig_id: "RHEL-07-010082" tag fix_id: "F-79603r1_fix" tag cci: ["CCI-000057"] tag nist: ["AC-11 a", "Rev_4"] unless package('gnome-desktop3').installed? impact 0.0 describe "The GNOME desktop is not installed" do skip "The GNOME desktop is not installed, this control is Not Applicable." end else describe command("gsettings writable org.gnome.desktop.session idle-delay") do its('stdout.strip') { should cmp 'false' } end end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with syscall == "chown" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "chown" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "chown" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "chown" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Result Details

Control V-72097
Title The Red Hat Enterprise Linux operating system must audit all uses of the chown syscall.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-2 d, AU-12 c, Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "chown" syscall occur. Check the file system rules in "/etc/audit/audit.rules" with the following commands: # grep -iw chown /etc/audit/audit.rules -a always,exit -F arch=b32 -S chown -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S chown -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the "b32" and "b64" audit rules are not defined for the "chown" syscall, this is a finding.
Fix Text Add or update the following rule in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S chown -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S chown -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72097" do title "The Red Hat Enterprise Linux operating system must audit all uses of the chown syscall." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"chown\" syscall occur. Check the file system rules in \"/etc/audit/audit.rules\" with the following commands: # grep -iw chown /etc/audit/audit.rules -a always,exit -F arch=b32 -S chown -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S chown -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the \"b32\" and \"b64\" audit rules are not defined for the \"chown\" syscall, this is a finding. " desc "fix", " Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S chown -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S chown -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000064-GPOS-00033" tag satisfies: ["SRG-OS-000064-GPOS-00033", "SRG-OS-000392-GPOS-00172", "SRG-OS-000458-GPOS-00203", "SRG-OS-000474-GPOS-00219"] tag gid: "V-72097" tag rid: "SV-86721r5_rule" tag stig_id: "RHEL-07-030370" tag fix_id: "F-78449r8_fix" tag cci: ["CCI-000126", "CCI-000172"] tag nist: ["AU-2 d", "AU-12 c", "Rev_4"] describe auditd.syscall("chown").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end if os.arch == 'x86_64' describe auditd.syscall("chown").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end end end
Malicious users with removable boot media can gain access to a system configured to use removable media as the boot loader. If removable media is designed to be used as the boot loader, the requirement must be documented with the Information System Security Officer (ISSO).
Test Results

Status passed
Test File UUID=5a000634-a1fc-467d-8ef4-5fcf5dbc6033 is expected to exist
Result expected File UUID=5a000634-a1fc-467d-8ef4-5fcf5dbc6033 to exist
Status passed
Test File UUID=5a000634-a1fc-467d-8ef4-5fcf5dbc6033 path is expected to match /^\/dev\//
Result expected "UUID=5a000634-a1fc-467d-8ef4-5fcf5dbc6033" to match /^\/dev\// Diff: @@ -1,2 +1,2 @@ -/^\/dev\// +"UUID=5a000634-a1fc-467d-8ef4-5fcf5dbc6033"
Status passed
Test File UUID=5a000634-a1fc-467d-8ef4-5fcf5dbc6033 is expected to exist
Result expected File UUID=5a000634-a1fc-467d-8ef4-5fcf5dbc6033 to exist
Status passed
Test File UUID=5a000634-a1fc-467d-8ef4-5fcf5dbc6033 path is expected to match /^\/dev\//
Result expected "UUID=5a000634-a1fc-467d-8ef4-5fcf5dbc6033" to match /^\/dev\// Diff: @@ -1,2 +1,2 @@ -/^\/dev\// +"UUID=5a000634-a1fc-467d-8ef4-5fcf5dbc6033"
Result Details

Control V-72075
Title The Red Hat Enterprise Linux operating system must not allow removable media to be used as the boot loader unless approved.
Desc Malicious users with removable boot media can gain access to a system configured to use removable media as the boot loader. If removable media is designed to be used as the boot loader, the requirement must be documented with the Information System Security Officer (ISSO).
Severity medium
Impact 0.5
Nist Controls CM-3 f, CM-6 c, CM-11 (2), CM-5 (1), CM-5 (1), Rev_4
Check Text Verify the system is not configured to use a boot loader on removable media. Note: GRUB 2 reads its configuration from the "/boot/grub2/grub.cfg" file on traditional BIOS-based machines and from the "/boot/efi/EFI/redhat/grub.cfg" file on UEFI machines. Check for the existence of alternate boot loader configuration files with the following command: # find / -name grub.cfg /boot/grub2/grub.cfg If a "grub.cfg" is found in any subdirectories other than "/boot/grub2" and "/boot/efi/EFI/redhat", ask the System Administrator if there is documentation signed by the ISSO to approve the use of removable media as a boot loader. Check that the grub configuration file has the set root command in each menu entry with the following commands: # grep -c menuentry /boot/grub2/grub.cfg 1 # grep 'set root' /boot/grub2/grub.cfg set root=(hd0,1) If the system is using an alternate boot loader on removable media, and documentation does not exist approving the alternate configuration, this is a finding.
Fix Text Remove alternate methods of booting the system from removable media or document the configuration to boot from removable media with the ISSO.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72075" do title "The Red Hat Enterprise Linux operating system must not allow removable media to be used as the boot loader unless approved." desc "Malicious users with removable boot media can gain access to a system configured to use removable media as the boot loader. If removable media is designed to be used as the boot loader, the requirement must be documented with the Information System Security Officer (ISSO)." desc "rationale", "" desc "check", " Verify the system is not configured to use a boot loader on removable media. Note: GRUB 2 reads its configuration from the \"/boot/grub2/grub.cfg\" file on traditional BIOS-based machines and from the \"/boot/efi/EFI/redhat/grub.cfg\" file on UEFI machines. Check for the existence of alternate boot loader configuration files with the following command: # find / -name grub.cfg /boot/grub2/grub.cfg If a \"grub.cfg\" is found in any subdirectories other than \"/boot/grub2\" and \"/boot/efi/EFI/redhat\", ask the System Administrator if there is documentation signed by the ISSO to approve the use of removable media as a boot loader. Check that the grub configuration file has the set root command in each menu entry with the following commands: # grep -c menuentry /boot/grub2/grub.cfg 1 # grep 'set root' /boot/grub2/grub.cfg set root=(hd0,1) If the system is using an alternate boot loader on removable media, and documentation does not exist approving the alternate configuration, this is a finding. " desc "fix", "Remove alternate methods of booting the system from removable media or document the configuration to boot from removable media with the ISSO." impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000364-GPOS-00151" tag gid: "V-72075" tag rid: "SV-86699r2_rule" tag stig_id: "RHEL-07-021700" tag fix_id: "F-78427r1_fix" tag cci: ["CCI-000318", "CCI-000368", "CCI-001812", "CCI-001813", "CCI-001814"] tag nist: ["CM-3 f", "CM-6 c", "CM-11 (2)", "CM-5 (1)", "CM-5 (1)", "Rev_4"] roots = command('grubby --info=ALL | grep "^root=" | sed "s/^root=//g"'). stdout.strip.split("\n") blocks = roots.map { |root| root_file = file(root) root_file.symlink? ? root_file.link_path : root_file.path } blocks.each { |block| block_file = file(block) describe block_file do it { should exist } its('path') { should match %r{^/dev/} } end if block_file.exist? and block_file.path.match? %r{^/dev/} removable = ['/sys/block', block.sub(%r{^/dev/}, ''), 'removable'].join('/') describe file(removable) do it { should exist } its('content.strip') { should eq '0' } end end } end
Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged ssh commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Test Results

Status passed
Test Auditd Rules with file == "/usr/libexec/openssh/ssh-keysign" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/usr/libexec/openssh/ssh-keysign" action is expected not to include "never"
Result
Status passed
Test ["x"] is expected to include "x"
Result
Status passed
Test ["x"] is expected to include "x"
Result
Result Details

Control V-72179
Title The Red Hat Enterprise Linux operating system must audit all uses of the ssh-keysign command.
Desc Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged ssh commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Severity medium
Impact 0.5
Nist Controls AU-3 (1), AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "ssh-keysign" command occur. Check that the following system call is being audited by performing the following command to check the file system rules in "/etc/audit/audit.rules": # grep -iw /usr/libexec/openssh/ssh-keysign /etc/audit/audit.rules -a always,exit -F path=/usr/libexec/openssh/ssh-keysign -F auid>=1000 -F auid!=4294967295 -k privileged-ssh If the command does not return any output, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "ssh-keysign" command occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules": -a always,exit -F path=/usr/libexec/openssh/ssh-keysign -F auid>=1000 -F auid!=4294967295 -k privileged-ssh The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72179" do title "The Red Hat Enterprise Linux operating system must audit all uses of the ssh-keysign command." desc "Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged ssh commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise. " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"ssh-keysign\" command occur. Check that the following system call is being audited by performing the following command to check the file system rules in \"/etc/audit/audit.rules\": # grep -iw /usr/libexec/openssh/ssh-keysign /etc/audit/audit.rules -a always,exit -F path=/usr/libexec/openssh/ssh-keysign -F auid>=1000 -F auid!=4294967295 -k privileged-ssh If the command does not return any output, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"ssh-keysign\" command occur. Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F path=/usr/libexec/openssh/ssh-keysign -F auid>=1000 -F auid!=4294967295 -k privileged-ssh The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000042-GPOS-00020" tag satisfies: ["SRG-OS-000042-GPOS-00020", "SRG-OS-000392-GPOS-00172", "SRG-OS-000471-GPOS-00215"] tag gid: "V-72179" tag rid: "SV-86803r3_rule" tag stig_id: "RHEL-07-030780" tag fix_id: "F-78533r4_fix" tag cci: ["CCI-000135", "CCI-000172", "CCI-002884"] tag nist: ["AU-3 (1)", "AU-12 c", "MA-4 (1) (a)", "Rev_4"] audit_file = '/usr/libexec/openssh/ssh-keysign' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'x' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
Restricting TFTP to a specific directory prevents remote users from copying, transferring, or overwriting system files.
Test Results

Status skipped
Test The TFTP package is not installed
Result
Result Details

Control V-72305
Title The Red Hat Enterprise Linux operating system must be configured so that if the Trivial File Transfer Protocol (TFTP) server is required, the TFTP daemon is configured to operate in secure mode.
Desc Restricting TFTP to a specific directory prevents remote users from copying, transferring, or overwriting system files.
Severity none
Nist Controls CM-6 b, Rev_4
Check Text Verify the TFTP daemon is configured to operate in secure mode. Check to see if a TFTP server has been installed with the following commands: # yum list installed tftp-server tftp-server.x86_64 x.x-x.el7 rhel-7-server-rpms If a TFTP server is not installed, this is Not Applicable. If a TFTP server is installed, check for the server arguments with the following command: # grep server_args /etc/xinetd.d/tftp server_args = -s /var/lib/tftpboot If the "server_args" line does not have a "-s" option and a subdirectory is not assigned, this is a finding.
Fix Text Configure the TFTP daemon to operate in secure mode by adding the following line to "/etc/xinetd.d/tftp" (or modify the line to have the required value): server_args = -s /var/lib/tftpboot

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72305" do title "The Red Hat Enterprise Linux operating system must be configured so that if the Trivial File Transfer Protocol (TFTP) server is required, the TFTP daemon is configured to operate in secure mode." desc "Restricting TFTP to a specific directory prevents remote users from copying, transferring, or overwriting system files." desc "rationale", "" desc "check", " Verify the TFTP daemon is configured to operate in secure mode. Check to see if a TFTP server has been installed with the following commands: # yum list installed tftp-server tftp-server.x86_64 x.x-x.el7 rhel-7-server-rpms If a TFTP server is not installed, this is Not Applicable. If a TFTP server is installed, check for the server arguments with the following command: # grep server_args /etc/xinetd.d/tftp server_args = -s /var/lib/tftpboot If the \"server_args\" line does not have a \"-s\" option and a subdirectory is not assigned, this is a finding. " desc "fix", " Configure the TFTP daemon to operate in secure mode by adding the following line to \"/etc/xinetd.d/tftp\" (or modify the line to have the required value): server_args = -s /var/lib/tftpboot " tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72305" tag rid: "SV-86929r3_rule" tag stig_id: "RHEL-07-040720" tag fix_id: "F-78659r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] if package('tftp-server').installed? impact 0.5 describe command('grep server_args /etc/xinetd.d/tftp') do its('stdout.strip') { should match %r{^\s*server_args\s+=\s+(-s|--secure)\s(\/\S+)$} } end else impact 0.0 describe "The TFTP package is not installed" do skip "If a TFTP server is not installed, this is Not Applicable." end end end
Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised.
Test Results

Status passed
Test Parse Config File /etc/security/pwquality.conf minclass.to_i is expected to cmp >= 4
Result
Result Details

Control V-71913
Title The Red Hat Enterprise Linux operating system must be configured so that when passwords are changed a minimum of four character classes must be changed.
Desc Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised.
Severity medium
Impact 0.5
Nist Controls IA-5 (1) (b), Rev_4
Check Text The "minclass" option sets the minimum number of required classes of characters for the new password (digits, upper-case, lower-case, others). Check for the value of the "minclass" option in "/etc/security/pwquality.conf" with the following command: # grep minclass /etc/security/pwquality.conf minclass = 4 If the value of "minclass" is set to less than "4", this is a finding.
Fix Text Configure the operating system to require the change of at least four character classes when passwords are changed by setting the "minclass" option. Add the following line to "/etc/security/pwquality.conf conf" (or modify the line to have the required value): minclass = 4

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71913" do title "The Red Hat Enterprise Linux operating system must be configured so that when passwords are changed a minimum of four character classes must be changed." desc "Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised. " desc "rationale", "" desc "check", " The \"minclass\" option sets the minimum number of required classes of characters for the new password (digits, upper-case, lower-case, others). Check for the value of the \"minclass\" option in \"/etc/security/pwquality.conf\" with the following command: # grep minclass /etc/security/pwquality.conf minclass = 4 If the value of \"minclass\" is set to less than \"4\", this is a finding. " desc "fix", " Configure the operating system to require the change of at least four character classes when passwords are changed by setting the \"minclass\" option. Add the following line to \"/etc/security/pwquality.conf conf\" (or modify the line to have the required value): minclass = 4 " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000072-GPOS-00040" tag gid: "V-71913" tag rid: "SV-86537r2_rule" tag stig_id: "RHEL-07-010170" tag fix_id: "F-78265r1_fix" tag cci: ["CCI-000195"] tag nist: ["IA-5 (1) (b)", "Rev_4"] describe parse_config_file("/etc/security/pwquality.conf") do its('minclass.to_i') { should cmp >= 4 } end end
The "noexec" mount option causes the system to not execute binary files. This option must be used for mounting any file system not containing approved binary files as they may be incompatible. Executing files from untrusted file systems increases the opportunity for unprivileged users to attain unauthorized administrative access.
Test Results

Status passed
Test No NFS file systems were found. is expected to eq true
Result
Result Details

Control V-73161
Title The Red Hat Enterprise Linux operating system must prevent binary files from being executed on file systems that are being imported via Network File System (NFS).
Desc The "noexec" mount option causes the system to not execute binary files. This option must be used for mounting any file system not containing approved binary files as they may be incompatible. Executing files from untrusted file systems increases the opportunity for unprivileged users to attain unauthorized administrative access.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify file systems that are being NFS imported are configured with the "noexec" option. Find the file system(s) that contain the directories being imported with the following command: # more /etc/fstab | grep nfs UUID=e06097bb-cfcd-437b-9e4d-a691f5662a7d /store nfs rw,noexec 0 0 If a file system found in "/etc/fstab" refers to NFS and it does not have the "noexec" option set, and use of NFS imported binaries is not documented with the Information System Security Officer (ISSO) as an operational requirement, this is a finding. Verify the NFS is mounted with the "noexec"option: # mount | grep nfs | grep noexec If no results are returned and use of NFS imported binaries is not documented with the Information System Security Officer (ISSO) as an operational requirement, this is a finding.
Fix Text Configure the "/etc/fstab" to use the "noexec" option on file systems that are being imported via NFS.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-73161" do title "The Red Hat Enterprise Linux operating system must prevent binary files from being executed on file systems that are being imported via Network File System (NFS)." desc "The \"noexec\" mount option causes the system to not execute binary files. This option must be used for mounting any file system not containing approved binary files as they may be incompatible. Executing files from untrusted file systems increases the opportunity for unprivileged users to attain unauthorized administrative access." desc "rationale", "" desc "check", " Verify file systems that are being NFS imported are configured with the \"noexec\" option. Find the file system(s) that contain the directories being imported with the following command: # more /etc/fstab | grep nfs UUID=e06097bb-cfcd-437b-9e4d-a691f5662a7d /store nfs rw,noexec 0 0 If a file system found in \"/etc/fstab\" refers to NFS and it does not have the \"noexec\" option set, and use of NFS imported binaries is not documented with the Information System Security Officer (ISSO) as an operational requirement, this is a finding. Verify the NFS is mounted with the \"noexec\"option: # mount | grep nfs | grep noexec If no results are returned and use of NFS imported binaries is not documented with the Information System Security Officer (ISSO) as an operational requirement, this is a finding. " desc "fix", "Configure the \"/etc/fstab\" to use the \"noexec\" option on file systems that are being imported via NFS." impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-73161" tag rid: "SV-87813r2_rule" tag stig_id: "RHEL-07-021021" tag fix_id: "F-79607r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] nfs_systems = etc_fstab.nfs_file_systems.entries if !nfs_systems.nil? and !nfs_systems.empty? nfs_systems.each do |file_system| describe file_system do its ('mount_options') { should include 'noexec' } end end else describe "No NFS file systems were found." do subject { nfs_systems.nil? or nfs_systems.empty? } it { should eq true } end end end
Using an authentication device, such as a CAC or token that is separate from the information system, ensures that even if the information system is compromised, that compromise will not affect credentials stored on the authentication device. Multifactor solutions that require devices separate from information systems gaining access include, for example, hardware tokens providing time-based or challenge-response authenticators and smart cards such as the U.S. Government Personal Identity Verification card and the DoD Common Access Card. A privileged account is defined as an information system account with authorizations of a privileged user. Remote access is access to DoD nonpublic information systems by an authorized user (or an information system) communicating through an external, non-organization-controlled network. Remote access methods include, for example, dial-up, broadband, and wireless. This requirement only applies to components where this is specific to the function of the device or has the concept of an organizational user (e.g., VPN, proxy capability). This does not apply to authentication for the purpose of configuring the device itself (management).
Test Results

Status passed
Test File /etc/pam_pkcs11/pam_pkcs11.conf is expected to exist
Result expected File /etc/pam_pkcs11/pam_pkcs11.conf to exist
Result Details

Control V-72433
Title The Red Hat Enterprise Linux operating system must implement certificate status checking for PKI authentication.
Desc Using an authentication device, such as a CAC or token that is separate from the information system, ensures that even if the information system is compromised, that compromise will not affect credentials stored on the authentication device. Multifactor solutions that require devices separate from information systems gaining access include, for example, hardware tokens providing time-based or challenge-response authenticators and smart cards such as the U.S. Government Personal Identity Verification card and the DoD Common Access Card. A privileged account is defined as an information system account with authorizations of a privileged user. Remote access is access to DoD nonpublic information systems by an authorized user (or an information system) communicating through an external, non-organization-controlled network. Remote access methods include, for example, dial-up, broadband, and wireless. This requirement only applies to components where this is specific to the function of the device or has the concept of an organizational user (e.g., VPN, proxy capability). This does not apply to authentication for the purpose of configuring the device itself (management).
Severity medium
Impact 0.5
Nist Controls IA-2 (11), IA-2 (12), IA-2 (12), Rev_4
Check Text Verify the operating system implements certificate status checking for PKI authentication. Check to see if Online Certificate Status Protocol (OCSP) is enabled on the system with the following command: # grep cert_policy /etc/pam_pkcs11/pam_pkcs11.conf | grep -v "^#" cert_policy = ca, ocsp_on, signature; cert_policy = ca, ocsp_on, signature; cert_policy = ca, ocsp_on, signature; There should be at least three lines returned. If "ocsp_on" is not present in all uncommented "cert_policy" lines in "/etc/pam_pkcs11/pam_pkcs11.conf", this is a finding.
Fix Text Configure the operating system to do certificate status checking for PKI authentication. Modify all of the "cert_policy" lines in "/etc/pam_pkcs11/pam_pkcs11.conf" to include "ocsp_on".

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72433" do title "The Red Hat Enterprise Linux operating system must implement certificate status checking for PKI authentication." desc "Using an authentication device, such as a CAC or token that is separate from the information system, ensures that even if the information system is compromised, that compromise will not affect credentials stored on the authentication device. Multifactor solutions that require devices separate from information systems gaining access include, for example, hardware tokens providing time-based or challenge-response authenticators and smart cards such as the U.S. Government Personal Identity Verification card and the DoD Common Access Card. A privileged account is defined as an information system account with authorizations of a privileged user. Remote access is access to DoD nonpublic information systems by an authorized user (or an information system) communicating through an external, non-organization-controlled network. Remote access methods include, for example, dial-up, broadband, and wireless. This requirement only applies to components where this is specific to the function of the device or has the concept of an organizational user (e.g., VPN, proxy capability). This does not apply to authentication for the purpose of configuring the device itself (management). " desc "rationale", "" desc "check", " Verify the operating system implements certificate status checking for PKI authentication. Check to see if Online Certificate Status Protocol (OCSP) is enabled on the system with the following command: # grep cert_policy /etc/pam_pkcs11/pam_pkcs11.conf | grep -v \"^#\" cert_policy = ca, ocsp_on, signature; cert_policy = ca, ocsp_on, signature; cert_policy = ca, ocsp_on, signature; There should be at least three lines returned. If \"ocsp_on\" is not present in all uncommented \"cert_policy\" lines in \"/etc/pam_pkcs11/pam_pkcs11.conf\", this is a finding. " desc "fix", " Configure the operating system to do certificate status checking for PKI authentication. Modify all of the \"cert_policy\" lines in \"/etc/pam_pkcs11/pam_pkcs11.conf\" to include \"ocsp_on\". " tag severity: nil tag gtitle: "SRG-OS-000375-GPOS-00160" tag satisfies: ["SRG-OS-000375-GPOS-00160", "SRG-OS-000375-GPOS-00161", "SRG-OS-000375-GPOS-00162"] tag gid: "V-72433" tag rid: "SV-87057r5_rule" tag stig_id: "RHEL-07-041003" tag fix_id: "F-78785r3_fix" tag cci: ["CCI-001948", "CCI-001953", "CCI-001954"] tag nist: ["IA-2 (11)", "IA-2 (12)", "IA-2 (12)", "Rev_4"] smart_card_status = input('smart_card_status') if smart_card_status.eql?('enabled') impact 0.5 if ((pam_file = file('/etc/pam_pkcs11/pam_pkcs11.conf')).exist?) cert_policy_lines = (pam_file.content.nil?)?[]: pam_file.content.lines.grep(%r{^(?!.+#).*cert_policy}i) if (cert_policy_lines.length < 3) describe "should contain at least 3 cert policy lines" do subject { cert_policy_lines.length } it { should >= 3 } end else describe "each cert policy line should include oscp_on" do cert_policy_lines.each do |line| subject { line } it { should match %r{=[^;]*ocsp_on}i } end end end else describe pam_file do it { should exist } end end else impact 0.0 describe "The system is not smartcard enabled" do skip "The system is not using Smartcards / PIVs to fulfil the MFA requirement, this control is Not Applicable." end end end
Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged postfix commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Test Results

Status passed
Test Auditd Rules with file == "/usr/sbin/postdrop" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/usr/sbin/postdrop" action is expected not to include "never"
Result
Status passed
Test ["x"] is expected to include "x"
Result
Result Details

Control V-72175
Title The Red Hat Enterprise Linux operating system must audit all uses of the postdrop command.
Desc Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged postfix commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Severity medium
Impact 0.5
Nist Controls AU-3 (1), MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "postdrop" command occur. Check that the following system call is being audited by performing the following command to check the file system rules in "/etc/audit/audit.rules": # grep -iw /usr/sbin/postdrop /etc/audit/audit.rules -a always,exit -F path=/usr/sbin/postdrop -F auid>=1000 -F auid!=4294967295 -k privileged-postfix If the command does not return any output, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "postdrop" command occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules": -a always,exit -F path=/usr/sbin/postdrop -F auid>=1000 -F auid!=4294967295 -k privileged-postfix The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72175" do title "The Red Hat Enterprise Linux operating system must audit all uses of the postdrop command." desc "Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged postfix commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise. " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"postdrop\" command occur. Check that the following system call is being audited by performing the following command to check the file system rules in \"/etc/audit/audit.rules\": # grep -iw /usr/sbin/postdrop /etc/audit/audit.rules -a always,exit -F path=/usr/sbin/postdrop -F auid>=1000 -F auid!=4294967295 -k privileged-postfix If the command does not return any output, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"postdrop\" command occur. Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F path=/usr/sbin/postdrop -F auid>=1000 -F auid!=4294967295 -k privileged-postfix The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000042-GPOS-00020" tag satisfies: ["SRG-OS-000042-GPOS-00020", "SRG-OS-000392-GPOS-00172"] tag gid: "V-72175" tag rid: "SV-86799r4_rule" tag stig_id: "RHEL-07-030760" tag fix_id: "F-78529r5_fix" tag cci: ["CCI-000135", "CCI-002884"] tag nist: ["AU-3 (1)", "MA-4 (1) (a)", "Rev_4"] audit_file = '/usr/sbin/postdrop' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'x' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with syscall == "open_by_handle_at" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "open_by_handle_at" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "open_by_handle_at" arch == "b32" exit.uniq is expected to include "-EPERM"
Result
Status passed
Test Auditd Rules with syscall == "open_by_handle_at" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "open_by_handle_at" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "open_by_handle_at" arch == "b32" exit.uniq is expected to include "-EACCES"
Result
Status passed
Test Auditd Rules with syscall == "open_by_handle_at" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "open_by_handle_at" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "open_by_handle_at" arch == "b64" exit.uniq is expected to include "-EPERM"
Result
Status passed
Test Auditd Rules with syscall == "open_by_handle_at" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "open_by_handle_at" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "open_by_handle_at" arch == "b64" exit.uniq is expected to include "-EACCES"
Result
Result Details

Control V-72129
Title The Red Hat Enterprise Linux operating system must audit all uses of the open_by_handle_at syscall.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "open_by_handle_at" syscall occur. Check the file system rules in "/etc/audit/audit.rules" with the following commands: # grep -iw open_by_handle_at /etc/audit/audit.rules -a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access If both the "b32" and "b64" audit rules are not defined for the "open_by_handle_at" syscall, this is a finding. If the output does not produce rules containing "-F exit=-EPERM", this is a finding. If the output does not produce rules containing "-F exit=-EACCES", this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "open_by_handle_at" syscall occur. Add or update the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72129" do title "The Red Hat Enterprise Linux operating system must audit all uses of the open_by_handle_at syscall." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"open_by_handle_at\" syscall occur. Check the file system rules in \"/etc/audit/audit.rules\" with the following commands: # grep -iw open_by_handle_at /etc/audit/audit.rules -a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access If both the \"b32\" and \"b64\" audit rules are not defined for the \"open_by_handle_at\" syscall, this is a finding. If the output does not produce rules containing \"-F exit=-EPERM\", this is a finding. If the output does not produce rules containing \"-F exit=-EACCES\", this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"open_by_handle_at\" syscall occur. Add or update the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b32 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S open_by_handle_at -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000064-GPOS-00033" tag satisfies: ["SRG-OS-000064-GPOS-00033", "SRG-OS-000458-GPOS-00203", "SRG-OS-000461-GPOS-00205", "SRG-OS-000392-GPOS-00172"] tag gid: "V-72129" tag rid: "SV-86753r5_rule" tag stig_id: "RHEL-07-030530" tag fix_id: "F-78481r8_fix" tag cci: ["CCI-000172", "CCI-002884"] tag nist: ["AU-12 c", "MA-4 (1) (a)", "Rev_4"] describe auditd.syscall("open_by_handle_at").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } its('exit.uniq') { should include '-EPERM' } end describe auditd.syscall("open_by_handle_at").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } its('exit.uniq') { should include '-EACCES' } end if os.arch == 'x86_64' describe auditd.syscall("open_by_handle_at").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } its('exit.uniq') { should include '-EPERM' } end describe auditd.syscall("open_by_handle_at").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } its('exit.uniq') { should include '-EACCES' } end end end
Without cryptographic integrity protections, information can be altered by unauthorized users without detection. Cryptographic mechanisms used for protecting the integrity of information include, for example, signed hash functions using asymmetric cryptography enabling distribution of the public key to verify the hash information while maintaining the confidentiality of the key used to generate the hash.
Test Results

Status skipped
Test LDAP not enabled
Result
Result Details

Control V-72231
Title The Red Hat Enterprise Linux operating system must implement cryptography to protect the integrity of Lightweight Directory Access Protocol (LDAP) communications.
Desc Without cryptographic integrity protections, information can be altered by unauthorized users without detection. Cryptographic mechanisms used for protecting the integrity of information include, for example, signed hash functions using asymmetric cryptography enabling distribution of the public key to verify the hash information while maintaining the confidentiality of the key used to generate the hash.
Severity none
Nist Controls AC-17 (2), Rev_4
Check Text If LDAP is not being utilized, this requirement is Not Applicable. Verify the operating system implements cryptography to protect the integrity of remote LDAP access sessions. To determine if LDAP is being used for authentication, use the following command: # systemctl status sssd.service sssd.service - System Security Services Daemon Loaded: loaded (/usr/lib/systemd/system/sssd.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2018-06-27 10:58:11 EST; 1h 50min ago If the "sssd.service" is "active", then LDAP is being used. Determine the "id_provider" that the LDAP is currently using: # grep -i "id_provider" /etc/sssd/sssd.conf id_provider = ad If "id_provider" is set to "ad", this is Not Applicable. Check the path to the X.509 certificate for peer authentication with the following command: # grep -i tls_cacert /etc/sssd/sssd.conf ldap_tls_cacert = /etc/pki/tls/certs/ca-bundle.crt Verify the "ldap_tls_cacert" option points to a file that contains the trusted CA certificate. If this file does not exist, or the option is commented out or missing, this is a finding.
Fix Text Configure the operating system to implement cryptography to protect the integrity of LDAP remote access sessions. Add or modify the following line in "/etc/sssd/sssd.conf": ldap_tls_cacert = /etc/pki/tls/certs/ca-bundle.crt

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72231" do title "The Red Hat Enterprise Linux operating system must implement cryptography to protect the integrity of Lightweight Directory Access Protocol (LDAP) communications." desc "Without cryptographic integrity protections, information can be altered by unauthorized users without detection. Cryptographic mechanisms used for protecting the integrity of information include, for example, signed hash functions using asymmetric cryptography enabling distribution of the public key to verify the hash information while maintaining the confidentiality of the key used to generate the hash. " desc "rationale", "" desc "check", " If LDAP is not being utilized, this requirement is Not Applicable. Verify the operating system implements cryptography to protect the integrity of remote LDAP access sessions. To determine if LDAP is being used for authentication, use the following command: # systemctl status sssd.service sssd.service - System Security Services Daemon Loaded: loaded (/usr/lib/systemd/system/sssd.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2018-06-27 10:58:11 EST; 1h 50min ago If the \"sssd.service\" is \"active\", then LDAP is being used. Determine the \"id_provider\" that the LDAP is currently using: # grep -i \"id_provider\" /etc/sssd/sssd.conf id_provider = ad If \"id_provider\" is set to \"ad\", this is Not Applicable. Check the path to the X.509 certificate for peer authentication with the following command: # grep -i tls_cacert /etc/sssd/sssd.conf ldap_tls_cacert = /etc/pki/tls/certs/ca-bundle.crt Verify the \"ldap_tls_cacert\" option points to a file that contains the trusted CA certificate. If this file does not exist, or the option is commented out or missing, this is a finding. " desc "fix", " Configure the operating system to implement cryptography to protect the integrity of LDAP remote access sessions. Add or modify the following line in \"/etc/sssd/sssd.conf\": ldap_tls_cacert = /etc/pki/tls/certs/ca-bundle.crt " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000250-GPOS-00093" tag gid: "V-72231" tag rid: "SV-86855r4_rule" tag stig_id: "RHEL-07-040200" tag fix_id: "F-78585r3_fix" tag cci: ["CCI-001453"] tag nist: ["AC-17 (2)", "Rev_4"] sssd_id_ldap_enabled = (package('sssd').installed? and !command('grep "^\s*id_provider\s*=\s*ldap" /etc/sssd/sssd.conf').stdout.strip.empty?) sssd_ldap_enabled = (package('sssd').installed? and !command('grep "^\s*[a-z]*_provider\s*=\s*ldap" /etc/sssd/sssd.conf').stdout.strip.empty?) pam_ldap_enabled = (!command('grep "^[^#]*pam_ldap\.so" /etc/pam.d/*').stdout.strip.empty?) if !(sssd_id_ldap_enabled or sssd_ldap_enabled or pam_ldap_enabled) impact 0.0 describe "LDAP not enabled" do skip "LDAP not enabled using any known mechanisms, this control is Not Applicable." end end if sssd_id_ldap_enabled ldap_id_use_start_tls = command('grep ldap_id_use_start_tls /etc/sssd/sssd.conf') describe ldap_id_use_start_tls do its('stdout.strip') { should match %r{^ldap_id_use_start_tls\s*=\s*true$}} end ldap_id_use_start_tls.stdout.strip.each_line do |line| describe line do it { should match %r{^ldap_id_use_start_tls\s*=\s*true$}} end end end if sssd_ldap_enabled ldap_tls_cacert = command('grep -i ldap_tls_cacert /etc/sssd/sssd.conf'). stdout.strip.scan(%r{^ldap_tls_cacert\s*=\s*(.*)}).last describe "ldap_tls_cacert" do subject { ldap_tls_cacert } it { should_not eq nil } end describe file(ldap_tls_cacert.last) do it { should exist } it { should be_file } end if !ldap_tls_cacert.nil? end if pam_ldap_enabled tls_cacertfile = command('grep -i tls_cacertfile /etc/pam_ldap.conf'). stdout.strip.scan(%r{^tls_cacertfile\s+(.*)}).last describe "tls_cacertfile" do subject { tls_cacertfile } it { should_not eq nil } end describe file(tls_cacertfile.last) do it { should exist } it { should be_file } end if !tls_cacertfile.nil? end end
Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged access commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Test Results

Status passed
Test Auditd Rules with file == "/usr/bin/su" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/usr/bin/su" action is expected not to include "never"
Result
Status passed
Test ["x"] is expected to include "x"
Result
Result Details

Control V-72159
Title The Red Hat Enterprise Linux operating system must audit all uses of the su command.
Desc Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged access commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Severity medium
Impact 0.5
Nist Controls AU-3, AU-3 (1), AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "su" command occur. Check that the following system call is being audited by performing the following command to check the file system rules in "/etc/audit/audit.rules": # grep -iw /usr/bin/su /etc/audit/audit.rules -a always,exit -F path=/usr/bin/su -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change If the command does not return any output, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "su" command occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules": -a always,exit -F path=/usr/bin/su -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72159" do title "The Red Hat Enterprise Linux operating system must audit all uses of the su command." desc "Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged access commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise. " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"su\" command occur. Check that the following system call is being audited by performing the following command to check the file system rules in \"/etc/audit/audit.rules\": # grep -iw /usr/bin/su /etc/audit/audit.rules -a always,exit -F path=/usr/bin/su -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change If the command does not return any output, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"su\" command occur. Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F path=/usr/bin/su -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000037-GPOS-00015" tag satisfies: ["SRG-OS-000037-GPOS-00015", "SRG-OS-000042-GPOS-00020", "SRG-OS-000392-GPOS-00172", "SRG-OS-000462-GPOS-00206", "SRG-OS-000471-GPOS-00215"] tag gid: "V-72159" tag rid: "SV-86783r5_rule" tag stig_id: "RHEL-07-030680" tag fix_id: "F-78511r6_fix" tag cci: ["CCI-000130", "CCI-000135", "CCI-000172", "CCI-002884"] tag nist: ["AU-3", "AU-3 (1)", "AU-12 c", "MA-4 (1) (a)", "Rev_4"] audit_file = '/usr/bin/su' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'x' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with syscall == "lsetxattr" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "lsetxattr" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "lsetxattr" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "lsetxattr" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Result Details

Control V-72115
Title The Red Hat Enterprise Linux operating system must audit all uses of the lsetxattr syscall.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-12 c, Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "lsetxattr" syscall occur. Check the file system rules in "/etc/audit/audit.rules" with the following commands: # grep -iw lsetxattr /etc/audit/audit.rules -a always,exit -F arch=b32 -S lsetxattr -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S lsetxattr -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the "b32" and "b64" audit rules are not defined for the "lsetxattr" syscall, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "lsetxattr" syscall occur. Add or update the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S lsetxattr -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S lsetxattr -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72115" do title "The Red Hat Enterprise Linux operating system must audit all uses of the lsetxattr syscall." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"lsetxattr\" syscall occur. Check the file system rules in \"/etc/audit/audit.rules\" with the following commands: # grep -iw lsetxattr /etc/audit/audit.rules -a always,exit -F arch=b32 -S lsetxattr -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S lsetxattr -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the \"b32\" and \"b64\" audit rules are not defined for the \"lsetxattr\" syscall, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"lsetxattr\" syscall occur. Add or update the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S lsetxattr -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S lsetxattr -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000458-GPOS-00203" tag satisfies: ["SRG-OS-000458-GPOS-00203", "SRG-OS-000392-GPOS-00172", "SRG-OS-000064-GPOS-00033"] tag gid: "V-72115" tag rid: "SV-86739r5_rule" tag stig_id: "RHEL-07-030460" tag fix_id: "F-78467r10_fix" tag cci: ["CCI-000172"] tag nist: ["AU-12 c", "Rev_4"] describe auditd.syscall("lsetxattr").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end if os.arch == 'x86_64' describe auditd.syscall("lsetxattr").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end end end
Enabling reverse path filtering drops packets with source addresses that should not have been able to be received on the interface they were received on. It should not be used on systems which are routers for complicated networks, but is helpful for end hosts and routers serving small networks.
Test Results

Status passed
Test Kernel Parameter net.ipv4.conf.default.rp_filter value is expected to eq 1
Result
Result Details

Control V-92253
Title The Red Hat Enterprise Linux operating system must use a reverse-path filter for IPv4 network traffic when possible by default.
Desc Enabling reverse path filtering drops packets with source addresses that should not have been able to be received on the interface they were received on. It should not be used on systems which are routers for complicated networks, but is helpful for end hosts and routers serving small networks.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the system uses a reverse-path filter for IPv4: # grep net.ipv4.conf.default.rp_filter /etc/sysctl.conf /etc/sysctl.d/* net.ipv4.conf.default.rp_filter = 1 If "net.ipv4.conf.default.rp_filter" is not configured in the /etc/sysctl.conf file or in the /etc/sysctl.d/ directory, is commented out, or does not have a value of "1", this is a finding. Check that the operating system implements the accept source route variable with the following command: # /sbin/sysctl -a | grep net.ipv4.conf.default.rp_filter net.ipv4.conf.default.rp_filter = 1 If the returned line does not have a value of "1", this is a finding.
Fix Text Set the system to the required kernel parameter by adding the following line to "/etc/sysctl.conf" or a configuration file in the /etc/sysctl.d/ directory (or modify the line to have the required value): net.ipv4.conf.default.rp_filter = 1 Issue the following command to make the changes take effect: # sysctl --system

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-92253" do title "The Red Hat Enterprise Linux operating system must use a reverse-path filter for IPv4 network traffic when possible by default." desc "Enabling reverse path filtering drops packets with source addresses that should not have been able to be received on the interface they were received on. It should not be used on systems which are routers for complicated networks, but is helpful for end hosts and routers serving small networks." desc "rationale", "" desc "check", " Verify the system uses a reverse-path filter for IPv4: # grep net.ipv4.conf.default.rp_filter /etc/sysctl.conf /etc/sysctl.d/* net.ipv4.conf.default.rp_filter = 1 If \"net.ipv4.conf.default.rp_filter\" is not configured in the /etc/sysctl.conf file or in the /etc/sysctl.d/ directory, is commented out, or does not have a value of \"1\", this is a finding. Check that the operating system implements the accept source route variable with the following command: # /sbin/sysctl -a | grep net.ipv4.conf.default.rp_filter net.ipv4.conf.default.rp_filter = 1 If the returned line does not have a value of \"1\", this is a finding. " desc "fix", " Set the system to the required kernel parameter by adding the following line to \"/etc/sysctl.conf\" or a configuration file in the /etc/sysctl.d/ directory (or modify the line to have the required value): net.ipv4.conf.default.rp_filter = 1 Issue the following command to make the changes take effect: # sysctl --system " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-92253" tag rid: "SV-102355r1_rule" tag stig_id: "RHEL-07-040612" tag fix_id: "F-98475r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe kernel_parameter('net.ipv4.conf.default.rp_filter') do its('value') { should eq 1 } end end
Terminating an idle session within a short time period reduces the window of opportunity for unauthorized personnel to take control of a management session enabled on the console or console port that has been left unattended. In addition, quickly terminating an idle session will also free up resources committed by the managed network element. Terminating network connections associated with communications sessions includes, for example, de-allocating associated TCP/IP address/port pairs at the operating system level and de-allocating networking assignments at the application level if multiple application sessions are using a single operating system-level network connection. This does not mean that the operating system terminates all sessions or network access; it only ends the inactive session and releases the resources associated with that session.
Test Results

Status passed
Test Environment variable TMOUT is expected to be <= 600
Result
Status passed
Test The TMOUT setting is configured properly is expected to be <= 600
Result
Result Details

Control V-72223
Title The Red Hat Enterprise Linux operating system must be configured so that all network connections associated with a communication session are terminated at the end of the session or after 10 minutes of inactivity from the user at a command prompt, except to fulfill documented and validated mission requirements.
Desc Terminating an idle session within a short time period reduces the window of opportunity for unauthorized personnel to take control of a management session enabled on the console or console port that has been left unattended. In addition, quickly terminating an idle session will also free up resources committed by the managed network element. Terminating network connections associated with communications sessions includes, for example, de-allocating associated TCP/IP address/port pairs at the operating system level and de-allocating networking assignments at the application level if multiple application sessions are using a single operating system-level network connection. This does not mean that the operating system terminates all sessions or network access; it only ends the inactive session and releases the resources associated with that session.
Severity medium
Impact 0.5
Nist Controls SC-10, AC-12, Rev_4
Check Text Verify the operating system terminates all network connections associated with a communications session at the end of the session or based on inactivity. Check the value of the system inactivity timeout with the following command: # grep -i tmout /etc/profile.d/* etc/profile.d/tmout.sh:TMOUT=600 /etc/profile.d/tmout.sh:readonly TMOUT /etc/profile.d/tmout.sh:export TMOUT If "TMOUT" is not set to "600" or less in a script located in the /etc/profile.d/ directory to enforce session termination after inactivity, this is a finding.
Fix Text Configure the operating system to terminate all network connections associated with a communications session at the end of the session or after a period of inactivity. Create a script to enforce the inactivity timeout (for example /etc/profile.d/tmout.sh) such as: #!/bin/bash TMOUT=600 readonly TMOUT export TMOUT

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72223" do title "The Red Hat Enterprise Linux operating system must be configured so that all network connections associated with a communication session are terminated at the end of the session or after 10 minutes of inactivity from the user at a command prompt, except to fulfill documented and validated mission requirements." desc "Terminating an idle session within a short time period reduces the window of opportunity for unauthorized personnel to take control of a management session enabled on the console or console port that has been left unattended. In addition, quickly terminating an idle session will also free up resources committed by the managed network element. Terminating network connections associated with communications sessions includes, for example, de-allocating associated TCP/IP address/port pairs at the operating system level and de-allocating networking assignments at the application level if multiple application sessions are using a single operating system-level network connection. This does not mean that the operating system terminates all sessions or network access; it only ends the inactive session and releases the resources associated with that session. " desc "rationale", "" desc "check", " Verify the operating system terminates all network connections associated with a communications session at the end of the session or based on inactivity. Check the value of the system inactivity timeout with the following command: # grep -i tmout /etc/profile.d/* etc/profile.d/tmout.sh:TMOUT=600 /etc/profile.d/tmout.sh:readonly TMOUT /etc/profile.d/tmout.sh:export TMOUT If \"TMOUT\" is not set to \"600\" or less in a script located in the /etc/profile.d/ directory to enforce session termination after inactivity, this is a finding. " desc "fix", " Configure the operating system to terminate all network connections associated with a communications session at the end of the session or after a period of inactivity. Create a script to enforce the inactivity timeout (for example /etc/profile.d/tmout.sh) such as: #!/bin/bash TMOUT=600 readonly TMOUT export TMOUT " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000163-GPOS-00072" tag gid: "V-72223" tag rid: "SV-86847r4_rule" tag stig_id: "RHEL-07-040160" tag fix_id: "F-78577r5_fix" tag cci: ["CCI-001133", "CCI-002361"] tag nist: ["SC-10", "AC-12", "Rev_4"] system_activity_timeout = input('system_activity_timeout') # Get current TMOUT environment variable (active test) describe 'Environment variable TMOUT' do subject { os_env('TMOUT').content.to_i } it { should be <= system_activity_timeout } end # Check if TMOUT is set in files (passive test) files = ['/etc/bashrc'] + ['/etc/profile'] + command("find /etc/profile.d/*").stdout.split("\n") latest_val = nil files.each do |file| readonly = false # Skip to next file if TMOUT isn't present. Otherwise, get the last occurrence of TMOUT next if (values = command("grep -Po '.*TMOUT.*' #{file}").stdout.split("\n")).empty? # Loop through each TMOUT match and see if set TMOUT's value or makes it readonly values.each_with_index { |value, index| # Skip if starts with '#' - it represents a comment next if !value.match(/^#/).nil? # If readonly and value is inline - use that value if !value.match(/^readonly[\s]+TMOUT[\s]*=[\s]*[\d]+$/).nil? latest_val = value.match(/[\d]+/)[0].to_i readonly = true break # If readonly, but, value is not inline - use the most recent value elsif !value.match(/^readonly[\s]+([\w]+[\s]+)?TMOUT[\s]*([\s]+[\w]+[\s]*)*$/).nil? # If the index is greater than 0, the configuraiton setting value. # Otherwise, the configuration setting value is in the previous file # and is already set in latest_val. if index >= 1 latest_val = values[index - 1].match(/[\d]+/)[0].to_i end readonly = true break # Readonly is not set use the lastest value else latest_val = value.match(/[\d]+/)[0].to_i end } # Readonly is set - stop processing files break if readonly === true end if latest_val.nil? describe "The TMOUT setting is configured" do subject { !latest_val.nil? } it { should be true } end else describe"The TMOUT setting is configured properly" do subject { latest_val } it { should be <= system_activity_timeout } end end end
Setting the most restrictive default permissions ensures that when new accounts are created, they do not have unnecessary access.
Test Results

Status passed
Test login.defs UMASK is expected to eq "077"
Result
Result Details

Control V-71995
Title The Red Hat Enterprise Linux operating system must define default permissions for all authenticated users in such a way that the user can only read and modify their own files.
Desc Setting the most restrictive default permissions ensures that when new accounts are created, they do not have unnecessary access.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the operating system defines default permissions for all authenticated users in such a way that the user can only read and modify their own files. Check for the value of the "UMASK" parameter in "/etc/login.defs" file with the following command: Note: If the value of the "UMASK" parameter is set to "000" in "/etc/login.defs" file, the Severity is raised to a CAT I. # grep -i umask /etc/login.defs UMASK 077 If the value for the "UMASK" parameter is not "077", or the "UMASK" parameter is missing or is commented out, this is a finding.
Fix Text Configure the operating system to define default permissions for all authenticated users in such a way that the user can only read and modify their own files. Add or edit the line for the "UMASK" parameter in "/etc/login.defs" file to "077": UMASK 077

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71995" do title "The Red Hat Enterprise Linux operating system must define default permissions for all authenticated users in such a way that the user can only read and modify their own files." desc "Setting the most restrictive default permissions ensures that when new accounts are created, they do not have unnecessary access." desc "rationale", "" desc "check", " Verify the operating system defines default permissions for all authenticated users in such a way that the user can only read and modify their own files. Check for the value of the \"UMASK\" parameter in \"/etc/login.defs\" file with the following command: Note: If the value of the \"UMASK\" parameter is set to \"000\" in \"/etc/login.defs\" file, the Severity is raised to a CAT I. # grep -i umask /etc/login.defs UMASK 077 If the value for the \"UMASK\" parameter is not \"077\", or the \"UMASK\" parameter is missing or is commented out, this is a finding. " desc "fix", " Configure the operating system to define default permissions for all authenticated users in such a way that the user can only read and modify their own files. Add or edit the line for the \"UMASK\" parameter in \"/etc/login.defs\" file to \"077\": UMASK 077 " tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00228" tag gid: "V-71995" tag rid: "SV-86619r2_rule" tag stig_id: "RHEL-07-020240" tag fix_id: "F-78347r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] if login_defs.read_params["UMASK"].eql?('000') impact 0.7 else impact 0.5 end describe login_defs do its('UMASK') { should eq '077' } end end
Extended attributes in file systems are used to contain arbitrary data and file metadata with security implications.
Test Results

Status passed
Test System Package aide is expected to be installed
Result
Status passed
Test List of monitored files/directories without 'xattrs' rule is expected to be empty
Result
Result Details

Control V-72071
Title The Red Hat Enterprise Linux operating system must be configured so that the file integrity tool is configured to verify extended attributes.
Desc Extended attributes in file systems are used to contain arbitrary data and file metadata with security implications.
Severity low
Impact 0.3
Nist Controls CM-6 b, Rev_4
Check Text Verify the file integrity tool is configured to verify extended attributes. Check to see if Advanced Intrusion Detection Environment (AIDE) is installed on the system with the following command: # yum list installed aide If AIDE is not installed, ask the System Administrator how file integrity checks are performed on the system. If there is no application installed to perform file integrity checks, this is a finding. Note: AIDE is highly configurable at install time. These commands assume the "aide.conf" file is under the "/etc" directory. Use the following command to determine if the file is in another location: # find / -name aide.conf Check the "aide.conf" file to determine if the "xattrs" rule has been added to the rule list being applied to the files and directories selection lists. An example rule that includes the "xattrs" rule follows: All= p+i+n+u+g+s+m+S+sha512+acl+xattrs+selinux /bin All # apply the custom rule to the files in bin /sbin All # apply the same custom rule to the files in sbin If the "xattrs" rule is not being used on all uncommented selection lines in the "/etc/aide.conf" file, or extended attributes are not being checked by another file integrity tool, this is a finding.
Fix Text Configure the file integrity tool to check file and directory extended attributes. If AIDE is installed, ensure the "xattrs" rule is present on all uncommented file and directory selection lists.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72071" do title "The Red Hat Enterprise Linux operating system must be configured so that the file integrity tool is configured to verify extended attributes." desc "Extended attributes in file systems are used to contain arbitrary data and file metadata with security implications." desc "rationale", "" desc "check", " Verify the file integrity tool is configured to verify extended attributes. Check to see if Advanced Intrusion Detection Environment (AIDE) is installed on the system with the following command: # yum list installed aide If AIDE is not installed, ask the System Administrator how file integrity checks are performed on the system. If there is no application installed to perform file integrity checks, this is a finding. Note: AIDE is highly configurable at install time. These commands assume the \"aide.conf\" file is under the \"/etc\" directory. Use the following command to determine if the file is in another location: # find / -name aide.conf Check the \"aide.conf\" file to determine if the \"xattrs\" rule has been added to the rule list being applied to the files and directories selection lists. An example rule that includes the \"xattrs\" rule follows: All= p+i+n+u+g+s+m+S+sha512+acl+xattrs+selinux /bin All # apply the custom rule to the files in bin /sbin All # apply the same custom rule to the files in sbin If the \"xattrs\" rule is not being used on all uncommented selection lines in the \"/etc/aide.conf\" file, or extended attributes are not being checked by another file integrity tool, this is a finding. " desc "fix", " Configure the file integrity tool to check file and directory extended attributes. If AIDE is installed, ensure the \"xattrs\" rule is present on all uncommented file and directory selection lists. " impact 0.3 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72071" tag rid: "SV-86695r3_rule" tag stig_id: "RHEL-07-021610" tag fix_id: "F-78423r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe package("aide") do it { should be_installed } end findings = [] aide_conf.where { !selection_line.start_with? '!' }.entries.each do |selection| unless selection.rules.include? 'xattrs' findings.append(selection.selection_line) end end describe "List of monitored files/directories without 'xattrs' rule" do subject { findings } it { should be_empty } end end
Any password, no matter how complex, can eventually be cracked. Therefore, passwords need to be changed periodically. If the operating system does not limit the lifetime of passwords and force users to change their passwords, there is the risk that the operating system passwords could be compromised.
Test Results

Status passed
Test login.defs PASS_MAX_DAYS.to_i is expected to cmp <= 60
Result
Result Details

Control V-71929
Title The Red Hat Enterprise Linux operating system must be configured so that passwords for new users are restricted to a 60-day maximum lifetime.
Desc Any password, no matter how complex, can eventually be cracked. Therefore, passwords need to be changed periodically. If the operating system does not limit the lifetime of passwords and force users to change their passwords, there is the risk that the operating system passwords could be compromised.
Severity medium
Impact 0.5
Nist Controls IA-5 (1) (d), Rev_4
Check Text If passwords are not being used for authentication, this is Not Applicable. Verify the operating system enforces a 60-day maximum password lifetime restriction for new user accounts. Check for the value of "PASS_MAX_DAYS" in "/etc/login.defs" with the following command: # grep -i pass_max_days /etc/login.defs PASS_MAX_DAYS 60 If the "PASS_MAX_DAYS" parameter value is not 60 or less, or is commented out, this is a finding.
Fix Text Configure the operating system to enforce a 60-day maximum password lifetime restriction. Add the following line in "/etc/login.defs" (or modify the line to have the required value): PASS_MAX_DAYS 60

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71929" do title "The Red Hat Enterprise Linux operating system must be configured so that passwords for new users are restricted to a 60-day maximum lifetime." desc "Any password, no matter how complex, can eventually be cracked. Therefore, passwords need to be changed periodically. If the operating system does not limit the lifetime of passwords and force users to change their passwords, there is the risk that the operating system passwords could be compromised." desc "rationale", "" desc "check", " If passwords are not being used for authentication, this is Not Applicable. Verify the operating system enforces a 60-day maximum password lifetime restriction for new user accounts. Check for the value of \"PASS_MAX_DAYS\" in \"/etc/login.defs\" with the following command: # grep -i pass_max_days /etc/login.defs PASS_MAX_DAYS 60 If the \"PASS_MAX_DAYS\" parameter value is not 60 or less, or is commented out, this is a finding. " desc "fix", " Configure the operating system to enforce a 60-day maximum password lifetime restriction. Add the following line in \"/etc/login.defs\" (or modify the line to have the required value): PASS_MAX_DAYS 60 " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000076-GPOS-00044" tag gid: "V-71929" tag rid: "SV-86553r2_rule" tag stig_id: "RHEL-07-010250" tag fix_id: "F-78281r1_fix" tag cci: ["CCI-000199"] tag nist: ["IA-5 (1) (d)", "Rev_4"] describe login_defs do its('PASS_MAX_DAYS.to_i') { should cmp <= 60 } end end
Automatically mounting file systems permits easy introduction of unknown devices, thereby facilitating malicious activity.
Test Results

Status passed
Test Service autofs.service is expected not to be running
Result
Status passed
Test Service autofs.service is expected not to be enabled
Result
Status passed
Test Service autofs.service is expected not to be installed
Result
Result Details

Control V-71985
Title The Red Hat Enterprise Linux operating system must disable the file system automounter unless required.
Desc Automatically mounting file systems permits easy introduction of unknown devices, thereby facilitating malicious activity.
Severity medium
Impact 0.5
Nist Controls CM-6 b, IA-3, IA-3, Rev_4
Check Text Verify the operating system disables the ability to automount devices. Check to see if automounter service is active with the following command: # systemctl status autofs autofs.service - Automounts filesystems on demand Loaded: loaded (/usr/lib/systemd/system/autofs.service; disabled) Active: inactive (dead) If the "autofs" status is set to "active" and is not documented with the Information System Security Officer (ISSO) as an operational requirement, this is a finding.
Fix Text Configure the operating system to disable the ability to automount devices. Turn off the automount service with the following commands: # systemctl stop autofs # systemctl disable autofs If "autofs" is required for Network File System (NFS), it must be documented with the ISSO.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71985" do title "The Red Hat Enterprise Linux operating system must disable the file system automounter unless required." desc "Automatically mounting file systems permits easy introduction of unknown devices, thereby facilitating malicious activity. " desc "rationale", "" desc "check", " Verify the operating system disables the ability to automount devices. Check to see if automounter service is active with the following command: # systemctl status autofs autofs.service - Automounts filesystems on demand Loaded: loaded (/usr/lib/systemd/system/autofs.service; disabled) Active: inactive (dead) If the \"autofs\" status is set to \"active\" and is not documented with the Information System Security Officer (ISSO) as an operational requirement, this is a finding. " desc "fix", " Configure the operating system to disable the ability to automount devices. Turn off the automount service with the following commands: # systemctl stop autofs # systemctl disable autofs If \"autofs\" is required for Network File System (NFS), it must be documented with the ISSO. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000114-GPOS-00059" tag satisfies: ["SRG-OS-000114-GPOS-00059", "SRG-OS-000378-GPOS-00163", "SRG-OS-000480-GPOS-00227"] tag gid: "V-71985" tag rid: "SV-86609r2_rule" tag stig_id: "RHEL-07-020110" tag fix_id: "F-78337r2_fix" tag cci: ["CCI-000366", "CCI-000778", "CCI-001958"] tag nist: ["CM-6 b", "IA-3", "IA-3", "Rev_4"] describe systemd_service('autofs.service') do it { should_not be_running } it { should_not be_enabled } it { should_not be_installed } end end
A locally logged-on user who presses Ctrl-Alt-Delete, when at the console, can reboot the system. If accidentally pressed, as could happen in the case of a mixed OS environment, this can create the risk of short-term loss of availability of systems due to unintentional reboot. In the GNOME graphical environment, risk of unintentional reboot from the Ctrl-Alt-Delete sequence is reduced because the user will be prompted before any action is taken.
Test Results

Status passed
Test Service ctrl-alt-del.target is expected not to be running
Result
Status passed
Test Service ctrl-alt-del.target is expected not to be enabled
Result
Result Details

Control V-71993
Title The Red Hat Enterprise Linux operating system must be configured so that the x86 Ctrl-Alt-Delete key sequence is disabled on the command line.
Desc A locally logged-on user who presses Ctrl-Alt-Delete, when at the console, can reboot the system. If accidentally pressed, as could happen in the case of a mixed OS environment, this can create the risk of short-term loss of availability of systems due to unintentional reboot. In the GNOME graphical environment, risk of unintentional reboot from the Ctrl-Alt-Delete sequence is reduced because the user will be prompted before any action is taken.
Severity high
Impact 0.7
Nist Controls CM-6 b, Rev_4
Check Text Verify the operating system is not configured to reboot the system when Ctrl-Alt-Delete is pressed. Check that the ctrl-alt-del.target is masked and not active with the following command: # systemctl status ctrl-alt-del.target ctrl-alt-del.target Loaded: masked (/dev/null; bad) Active: inactive (dead) If the ctrl-alt-del.target is not masked, this is a finding. If the ctrl-alt-del.target is active, this is a finding.
Fix Text Configure the system to disable the Ctrl-Alt-Delete sequence for the command line with the following command: # systemctl mask ctrl-alt-del.target

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71993" do title "The Red Hat Enterprise Linux operating system must be configured so that the x86 Ctrl-Alt-Delete key sequence is disabled on the command line." desc "A locally logged-on user who presses Ctrl-Alt-Delete, when at the console, can reboot the system. If accidentally pressed, as could happen in the case of a mixed OS environment, this can create the risk of short-term loss of availability of systems due to unintentional reboot. In the GNOME graphical environment, risk of unintentional reboot from the Ctrl-Alt-Delete sequence is reduced because the user will be prompted before any action is taken." desc "rationale", "" desc "check", " Verify the operating system is not configured to reboot the system when Ctrl-Alt-Delete is pressed. Check that the ctrl-alt-del.target is masked and not active with the following command: # systemctl status ctrl-alt-del.target ctrl-alt-del.target Loaded: masked (/dev/null; bad) Active: inactive (dead) If the ctrl-alt-del.target is not masked, this is a finding. If the ctrl-alt-del.target is active, this is a finding. " desc "fix", " Configure the system to disable the Ctrl-Alt-Delete sequence for the command line with the following command: # systemctl mask ctrl-alt-del.target " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-71993" tag rid: "SV-86617r5_rule" tag stig_id: "RHEL-07-020230" tag fix_id: "F-78345r6_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe systemd_service('ctrl-alt-del.target') do it { should_not be_running } it { should_not be_enabled } end end
Misuse of privileged functions, either intentionally or unintentionally by authorized users, or by unauthorized external entities that have compromised information system accounts, is a serious and ongoing concern and can have significant adverse impacts on organizations. Auditing the use of privileged functions is one way to detect such misuse and identify the risk from insider threats and the advanced persistent threat.
Test Results

Status passed
Test Auditd Rules with syscall == "execve" action.uniq is expected to eq ["always"]
Result expected: ["always"] got: [] (compared using ==)
Status passed
Test Auditd Rules with syscall == "execve" list.uniq is expected to eq ["exit"]
Result expected: ["exit"] got: [] (compared using ==)
Status passed
Test Auditd Rules with syscall == "execve" fields include? "euid=0" arch.uniq is expected to include "b32"
Result expected [] to include "b32"
Status passed
Test Auditd Rules with syscall == "execve" fields include? "euid=0" arch.uniq is expected to include "b64"
Result expected [] to include "b64"
Status passed
Test Auditd Rules with syscall == "execve" fields include? "egid=0" arch.uniq is expected to include "b32"
Result expected [] to include "b32"
Status passed
Test Auditd Rules with syscall == "execve" fields include? "egid=0" arch.uniq is expected to include "b64"
Result expected [] to include "b64"
Result Details

Control V-72095
Title The Red Hat Enterprise Linux operating system must audit all executions of privileged functions.
Desc Misuse of privileged functions, either intentionally or unintentionally by authorized users, or by unauthorized external entities that have compromised information system accounts, is a serious and ongoing concern and can have significant adverse impacts on organizations. Auditing the use of privileged functions is one way to detect such misuse and identify the risk from insider threats and the advanced persistent threat.
Severity medium
Impact 0.5
Nist Controls AC-6 (9), Rev_4
Check Text Verify the operating system audits the execution of privileged functions using the following command: # grep -iw execve /etc/audit/audit.rules -a always,exit -F arch=b32 -S execve -C uid!=euid -F euid=0 -k setuid -a always,exit -F arch=b64 -S execve -C uid!=euid -F euid=0 -k setuid -a always,exit -F arch=b32 -S execve -C gid!=egid -F egid=0 -k setgid -a always,exit -F arch=b64 -S execve -C gid!=egid -F egid=0 -k setgid If both the "b32" and "b64" audit rules for "SUID" files are not defined, this is a finding. If both the "b32" and "b64" audit rules for "SGID" files are not defined, this is a finding.
Fix Text Configure the operating system to audit the execution of privileged functions. Add or update the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S execve -C uid!=euid -F euid=0 -k setuid -a always,exit -F arch=b64 -S execve -C uid!=euid -F euid=0 -k setuid -a always,exit -F arch=b32 -S execve -C gid!=egid -F egid=0 -k setgid -a always,exit -F arch=b64 -S execve -C gid!=egid -F egid=0 -k setgid The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72095" do title "The Red Hat Enterprise Linux operating system must audit all executions of privileged functions." desc "Misuse of privileged functions, either intentionally or unintentionally by authorized users, or by unauthorized external entities that have compromised information system accounts, is a serious and ongoing concern and can have significant adverse impacts on organizations. Auditing the use of privileged functions is one way to detect such misuse and identify the risk from insider threats and the advanced persistent threat." desc "rationale", "" desc "check", " Verify the operating system audits the execution of privileged functions using the following command: # grep -iw execve /etc/audit/audit.rules -a always,exit -F arch=b32 -S execve -C uid!=euid -F euid=0 -k setuid -a always,exit -F arch=b64 -S execve -C uid!=euid -F euid=0 -k setuid -a always,exit -F arch=b32 -S execve -C gid!=egid -F egid=0 -k setgid -a always,exit -F arch=b64 -S execve -C gid!=egid -F egid=0 -k setgid If both the \"b32\" and \"b64\" audit rules for \"SUID\" files are not defined, this is a finding. If both the \"b32\" and \"b64\" audit rules for \"SGID\" files are not defined, this is a finding. " desc "fix", " Configure the operating system to audit the execution of privileged functions. Add or update the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S execve -C uid!=euid -F euid=0 -k setuid -a always,exit -F arch=b64 -S execve -C uid!=euid -F euid=0 -k setuid -a always,exit -F arch=b32 -S execve -C gid!=egid -F egid=0 -k setgid -a always,exit -F arch=b64 -S execve -C gid!=egid -F egid=0 -k setgid The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000327-GPOS-00127" tag gid: "V-72095" tag rid: "SV-86719r7_rule" tag stig_id: "RHEL-07-030360" tag fix_id: "F-78447r9_fix" tag cci: ["CCI-002234"] tag nist: ["AC-6 (9)", "Rev_4"] # All execve calls should use 'always,exit' describe auditd.syscall('execve') do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end # Work with the SUID rules describe auditd.syscall('execve').where { fields.include?('euid=0') } do its ('arch.uniq') { should include 'b32' } its ('arch.uniq') { should include 'b64' } end # Work with the SGID rules describe auditd.syscall('execve').where { fields.include?('egid=0') } do its ('arch.uniq') { should include 'b32' } its ('arch.uniq') { should include 'b64' } end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with syscall == "openat" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "openat" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "openat" arch == "b32" exit.uniq is expected to include "-EPERM"
Result
Status passed
Test Auditd Rules with syscall == "openat" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "openat" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "openat" arch == "b32" exit.uniq is expected to include "-EACCES"
Result
Status passed
Test Auditd Rules with syscall == "openat" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "openat" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "openat" arch == "b64" exit.uniq is expected to include "-EPERM"
Result
Status passed
Test Auditd Rules with syscall == "openat" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "openat" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "openat" arch == "b64" exit.uniq is expected to include "-EACCES"
Result
Result Details

Control V-72127
Title The Red Hat Enterprise Linux operating system must audit all uses of the openat syscall.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "openat" syscall occur. Check the file system rules in "/etc/audit/audit.rules" with the following commands: # grep -iw openat /etc/audit/audit.rules -a always,exit -F arch=b32 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b32 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access If both the "b32" and "b64" audit rules are not defined for the "openat" syscall, this is a finding. If the output does not produce rules containing "-F exit=-EPERM", this is a finding. If the output does not produce rules containing "-F exit=-EACCES", this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "openat" syscall occur. Add or update the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b32 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72127" do title "The Red Hat Enterprise Linux operating system must audit all uses of the openat syscall." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"openat\" syscall occur. Check the file system rules in \"/etc/audit/audit.rules\" with the following commands: # grep -iw openat /etc/audit/audit.rules -a always,exit -F arch=b32 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b32 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access If both the \"b32\" and \"b64\" audit rules are not defined for the \"openat\" syscall, this is a finding. If the output does not produce rules containing \"-F exit=-EPERM\", this is a finding. If the output does not produce rules containing \"-F exit=-EACCES\", this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"openat\" syscall occur. Add or update the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b32 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S openat -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S openat -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000064-GPOS-00033" tag satisfies: ["SRG-OS-000064-GPOS-00033", "SRG-OS-000458-GPOS-00203", "SRG-OS-000461-GPOS-00205", "SRG-OS-000392-GPOS-00172"] tag gid: "V-72127" tag rid: "SV-86751r5_rule" tag stig_id: "RHEL-07-030520" tag fix_id: "F-78479r8_fix" tag cci: ["CCI-000172", "CCI-002884"] tag nist: ["AU-12 c", "MA-4 (1) (a)", "Rev_4"] describe auditd.syscall("openat").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } its('exit.uniq') { should include '-EPERM' } end describe auditd.syscall("openat").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } its('exit.uniq') { should include '-EACCES' } end if os.arch == 'x86_64' describe auditd.syscall("openat").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } its('exit.uniq') { should include '-EPERM' } end describe auditd.syscall("openat").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } its('exit.uniq') { should include '-EACCES' } end end end
Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged access commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Test Results

Status passed
Test Auditd Rules with file == "/usr/bin/chsh" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/usr/bin/chsh" action is expected not to include "never"
Result
Status passed
Test ["x"] is expected to include "x"
Result
Status passed
Test ["x"] is expected to include "x"
Result
Result Details

Control V-72167
Title The Red Hat Enterprise Linux operating system must audit all uses of the chsh command.
Desc Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged access commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Severity medium
Impact 0.5
Nist Controls AU-3, AU-3 (1), AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "chsh" command occur. Check that the following system call is being audited by performing the following command to check the file system rules in "/etc/audit/audit.rules": # grep -i /usr/bin/chsh /etc/audit/audit.rules -a always,exit -F path=/usr/bin/chsh -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change If the command does not return any output, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "chsh" command occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules": -a always,exit -F path=/usr/bin/chsh -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72167" do title "The Red Hat Enterprise Linux operating system must audit all uses of the chsh command." desc "Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged access commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise. " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"chsh\" command occur. Check that the following system call is being audited by performing the following command to check the file system rules in \"/etc/audit/audit.rules\": # grep -i /usr/bin/chsh /etc/audit/audit.rules -a always,exit -F path=/usr/bin/chsh -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change If the command does not return any output, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"chsh\" command occur. Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F path=/usr/bin/chsh -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000037-GPOS-00015" tag satisfies: ["SRG-OS-000037-GPOS-00015", "SRG-OS-000042-GPOS-00020", "SRG-OS-000392-GPOS-00172", "SRG-OS-000462-GPOS-00206", "SRG-OS-000471-GPOS-00215"] tag gid: "V-72167" tag rid: "SV-86791r4_rule" tag stig_id: "RHEL-07-030720" tag fix_id: "F-78521r5_fix" tag cci: ["CCI-000130", "CCI-000135", "CCI-000172", "CCI-002884"] tag nist: ["AU-3", "AU-3 (1)", "AU-12 c", "MA-4 (1) (a)", "Rev_4"] audit_file = '/usr/bin/chsh' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'x' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with file == "/etc/shadow" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/etc/shadow" action is expected not to include "never"
Result
Status passed
Test ["w", "a"] is expected to include "w"
Result
Status passed
Test ["w", "a"] is expected to include "a"
Result
Result Details

Control V-73171
Title The Red Hat Enterprise Linux operating system must generate audit records for all account creations, modifications, disabling, and termination events that affect /etc/shadow.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AC-2 (4), AU-12 c, AC-2 (4), AC-2 (4), Rev_4
Check Text Verify the operating system must generate audit records for all account creations, modifications, disabling, and termination events that affect /etc/shadow. Check the auditing rules in "/etc/audit/audit.rules" with the following command: # grep /etc/shadow /etc/audit/audit.rules -w /etc/shadow -p wa -k identity If the command does not return a line, or the line is commented out, this is a finding.
Fix Text Configure the operating system to generate audit records for all account creations, modifications, disabling, and termination events that affect /etc/shadow. Add or update the following file system rule in "/etc/audit/rules.d/audit.rules": -w /etc/shadow -p wa -k identity The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-73171" do title "The Red Hat Enterprise Linux operating system must generate audit records for all account creations, modifications, disabling, and termination events that affect /etc/shadow." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system must generate audit records for all account creations, modifications, disabling, and termination events that affect /etc/shadow. Check the auditing rules in \"/etc/audit/audit.rules\" with the following command: # grep /etc/shadow /etc/audit/audit.rules -w /etc/shadow -p wa -k identity If the command does not return a line, or the line is commented out, this is a finding. " desc "fix", " Configure the operating system to generate audit records for all account creations, modifications, disabling, and termination events that affect /etc/shadow. Add or update the following file system rule in \"/etc/audit/rules.d/audit.rules\": -w /etc/shadow -p wa -k identity The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000004-GPOS-00004" tag gid: "V-73171" tag rid: "SV-87823r4_rule" tag stig_id: "RHEL-07-030873" tag fix_id: "F-79617r4_fix" tag cci: ["CCI-000018", "CCI-000172", "CCI-001403", "CCI-002130"] tag nist: ["AC-2 (4)", "AU-12 c", "AC-2 (4)", "AC-2 (4)", "Rev_4"] audit_file = '/etc/shadow' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'w' } it { should include 'a' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
If unrestricted mail relaying is permitted, unauthorized senders could use this host as a mail relay for the purpose of sending spam or other unauthorized activity.
Test Results

Status passed
Test Command: `postconf -n smtpd_client_restrictions` stdout.strip is expected to match /^smtpd_client_restrictions\s+=\s+permit_mynetworks,\s*reject\s*$/
Result
Result Details

Control V-72297
Title The Red Hat Enterprise Linux operating system must be configured to prevent unrestricted mail relaying.
Desc If unrestricted mail relaying is permitted, unauthorized senders could use this host as a mail relay for the purpose of sending spam or other unauthorized activity.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the system is configured to prevent unrestricted mail relaying. Determine if "postfix" is installed with the following commands: # yum list installed postfix postfix-2.6.6-6.el7.x86_64.rpm If postfix is not installed, this is Not Applicable. If postfix is installed, determine if it is configured to reject connections from unknown or untrusted networks with the following command: # postconf -n smtpd_client_restrictions smtpd_client_restrictions = permit_mynetworks, reject If the "smtpd_client_restrictions" parameter contains any entries other than "permit_mynetworks" and "reject", this is a finding.
Fix Text If "postfix" is installed, modify the "/etc/postfix/main.cf" file to restrict client connections to the local network with the following command: # postconf -e 'smtpd_client_restrictions = permit_mynetworks,reject'

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72297" do title "The Red Hat Enterprise Linux operating system must be configured to prevent unrestricted mail relaying." desc "If unrestricted mail relaying is permitted, unauthorized senders could use this host as a mail relay for the purpose of sending spam or other unauthorized activity." desc "rationale", "" desc "check", " Verify the system is configured to prevent unrestricted mail relaying. Determine if \"postfix\" is installed with the following commands: # yum list installed postfix postfix-2.6.6-6.el7.x86_64.rpm If postfix is not installed, this is Not Applicable. If postfix is installed, determine if it is configured to reject connections from unknown or untrusted networks with the following command: # postconf -n smtpd_client_restrictions smtpd_client_restrictions = permit_mynetworks, reject If the \"smtpd_client_restrictions\" parameter contains any entries other than \"permit_mynetworks\" and \"reject\", this is a finding. " desc "fix", " If \"postfix\" is installed, modify the \"/etc/postfix/main.cf\" file to restrict client connections to the local network with the following command: # postconf -e 'smtpd_client_restrictions = permit_mynetworks,reject' " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72297" tag rid: "SV-86921r3_rule" tag stig_id: "RHEL-07-040680" tag fix_id: "F-78651r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] # Only permit_mynetworks and reject should be allowed describe.one do describe command('postconf -n smtpd_client_restrictions') do its('stdout.strip') { should match %r{^smtpd_client_restrictions\s+=\s+permit_mynetworks,\s*reject\s*$} } end describe command('postconf -n smtpd_client_restrictions') do its('stdout.strip') { should match %r{^smtpd_client_restrictions\s+=\s+permit_mynetworks\s*$} } end describe command('postconf -n smtpd_client_restrictions') do its('stdout.strip') { should match %r{^smtpd_client_restrictions\s+=\s+reject\s*$} } end describe command('postconf -n smtpd_client_restrictions') do its('stdout.strip') { should match %r{^smtpd_client_restrictions\s+=\s+reject,\s*permit_mynetworks\s*$} } end end if package('postfix').installed? describe "The `postfix` package is not installed" do skip "The `postfix` package is not installed, this control is Not Applicable" end if !package('postfix').installed? end
Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged access commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Test Results

Status passed
Test Auditd Rules with file == "/etc/sudoers" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/etc/sudoers" action is expected not to include "never"
Result
Status passed
Test ["w", "a"] is expected to include "w"
Result
Status passed
Test ["w", "a"] is expected to include "a"
Result
Status passed
Test Auditd Rules with file == "/etc/sudoers.d" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/etc/sudoers.d" action is expected not to include "never"
Result
Status passed
Test ["w", "a"] is expected to include "w"
Result
Status passed
Test ["w", "a"] is expected to include "a"
Result
Result Details

Control V-72163
Title The Red Hat Enterprise Linux operating system must audit all uses of the sudoers file and all files in the /etc/sudoers.d/ directory.
Desc Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged access commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Severity medium
Impact 0.5
Nist Controls AU-3, AU-3 (1), AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to access the "/etc/sudoers" file and files in the "/etc/sudoers.d/" directory. Check for modification of the following files being audited by performing the following commands to check the file system rules in "/etc/audit/audit.rules": # grep -i "/etc/sudoers" /etc/audit/audit.rules -w /etc/sudoers -p wa -k privileged-actions # grep -i "/etc/sudoers.d/" /etc/audit/audit.rules -w /etc/sudoers.d/ -p wa -k privileged-actions If the commands do not return output that match the examples, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to access the "/etc/sudoers" file and files in the "/etc/sudoers.d/" directory. Add or update the following rule in "/etc/audit/rules.d/audit.rules": -w /etc/sudoers -p wa -k privileged-actions -w /etc/sudoers.d/ -p wa -k privileged-actions The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72163" do title "The Red Hat Enterprise Linux operating system must audit all uses of the sudoers file and all files in the /etc/sudoers.d/ directory." desc "Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged access commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise. " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to access the \"/etc/sudoers\" file and files in the \"/etc/sudoers.d/\" directory. Check for modification of the following files being audited by performing the following commands to check the file system rules in \"/etc/audit/audit.rules\": # grep -i \"/etc/sudoers\" /etc/audit/audit.rules -w /etc/sudoers -p wa -k privileged-actions # grep -i \"/etc/sudoers.d/\" /etc/audit/audit.rules -w /etc/sudoers.d/ -p wa -k privileged-actions If the commands do not return output that match the examples, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to access the \"/etc/sudoers\" file and files in the \"/etc/sudoers.d/\" directory. Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -w /etc/sudoers -p wa -k privileged-actions -w /etc/sudoers.d/ -p wa -k privileged-actions The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000037-GPOS-00015" tag satisfies: ["SRG-OS-000037-GPOS-00015", "SRG-OS-000042-GPOS-00020", "SRG-OS-000392-GPOS-00172", "SRG-OS-000462-GPOS-00206", "SRG-OS-000471-GPOS-00215"] tag gid: "V-72163" tag rid: "SV-86787r5_rule" tag stig_id: "RHEL-07-030700" tag fix_id: "F-78517r6_fix" tag cci: ["CCI-000130", "CCI-000135", "CCI-000172", "CCI-002884"] tag nist: ["AU-3", "AU-3 (1)", "AU-12 c", "MA-4 (1) (a)", "Rev_4"] audit_files = ['/etc/sudoers', '/etc/sudoers.d'] if audit_files.any? { |audit_file| file(audit_file).exist? } impact 0.5 else impact 0.0 end audit_files.each do |audit_file| describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'w' } it { should include 'a' } end end if file(audit_file).exist? end describe "The #{audit_files} files do not exist" do skip "The #{audit_files} files do not exist, this requirement is Not Applicable." end if !audit_files.any? { |audit_file| file(audit_file).exist? } end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with syscall == "fchmodat" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "fchmodat" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "fchmodat" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "fchmodat" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Result Details

Control V-72109
Title The Red Hat Enterprise Linux operating system must audit all uses of the fchmodat syscall.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-12 c, Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "fchmodat" syscall occur. Check the file system rules in "/etc/audit/audit.rules" with the following command: # grep -iw fchmodat /etc/audit/audit.rules -a always,exit -F arch=b32 -S fchmodat -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S fchmodat -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the "b32" and "b64" audit rules are not defined for the "fchmodat" syscall, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "fchmodat" syscall occur. Add or update the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S fchmodat -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S fchmodat -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72109" do title "The Red Hat Enterprise Linux operating system must audit all uses of the fchmodat syscall." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"fchmodat\" syscall occur. Check the file system rules in \"/etc/audit/audit.rules\" with the following command: # grep -iw fchmodat /etc/audit/audit.rules -a always,exit -F arch=b32 -S fchmodat -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S fchmodat -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the \"b32\" and \"b64\" audit rules are not defined for the \"fchmodat\" syscall, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"fchmodat\" syscall occur. Add or update the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S fchmodat -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S fchmodat -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000458-GPOS-00203" tag satisfies: ["SRG-OS-000458-GPOS-00203", "SRG-OS-000392-GPOS-00172", "SRG-OS-000064-GPOS-00033"] tag gid: "V-72109" tag rid: "SV-86733r5_rule" tag stig_id: "RHEL-07-030430" tag fix_id: "F-78461r8_fix" tag cci: ["CCI-000172"] tag nist: ["AU-12 c", "Rev_4"] describe auditd.syscall("fchmodat").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end if os.arch == 'x86_64' describe auditd.syscall("fchmodat").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end end end
Timely patching is critical for maintaining the operational availability, confidentiality, and integrity of information technology (IT) systems. However, failure to keep operating system and application software patched is a common mistake made by IT professionals. New patches are released daily, and it is often difficult for even experienced System Administrators to keep abreast of all the new patches. When new weaknesses in an operating system exist, patches are usually made available by the vendor to resolve the problems. If the most recent security patches and updates are not installed, unauthorized users may take advantage of weaknesses in the unpatched software. The lack of prompt attention to patching could result in a system compromise.
Test Results

Status passed
Test List of out-of-date packages is expected to be empty
Result expected `["bind-export-libs", "device-mapper", "device-mapper-libs", "python-requests", "systemd", "puppet5-release", "systemd-sysv", "systemd-libs", "libgudev1", "rh-amazon-rhui-client"].empty?` to return true, got false
Status passed
Test System Package bind-export-libs version is expected to eq "9.11.4-16.P2.el7_8.2"
Result expected: "9.11.4-16.P2.el7_8.2" got: "9.11.4-16.P2.el7" (compared using ==)
Status passed
Test System Package device-mapper version is expected to eq "1.02.164-7.el7_8.1"
Result expected: "1.02.164-7.el7_8.1" got: "1.02.164-7.el7" (compared using ==)
Status passed
Test System Package device-mapper-libs version is expected to eq "1.02.164-7.el7_8.1"
Result expected: "1.02.164-7.el7_8.1" got: "1.02.164-7.el7" (compared using ==)
Status passed
Test System Package python-requests version is expected to eq "2.6.0-9.el7_8"
Result expected: "2.6.0-9.el7_8" got: "2.6.0-8.el7_7" (compared using ==)
Status passed
Test System Package systemd version is expected to eq "219-73.el7_8.5"
Result expected: "219-73.el7_8.5" got: "219-73.el7.1" (compared using ==)
Status passed
Test System Package puppet5-release version is expected to eq "5.0.0-11.el6"
Result expected: "5.0.0-11.el6" got: "5.0.0-4.el6" (compared using ==)
Status passed
Test System Package systemd-sysv version is expected to eq "219-73.el7_8.5"
Result expected: "219-73.el7_8.5" got: "219-73.el7.1" (compared using ==)
Status passed
Test System Package systemd-libs version is expected to eq "219-73.el7_8.5"
Result expected: "219-73.el7_8.5" got: "219-73.el7.1" (compared using ==)
Status passed
Test System Package libgudev1 version is expected to eq "219-73.el7_8.5"
Result expected: "219-73.el7_8.5" got: "219-73.el7.1" (compared using ==)
Status passed
Test System Package rh-amazon-rhui-client version is expected to eq "3.0.26-1.el7"
Result expected: "3.0.26-1.el7" got: "3.0.18-1.el7" (compared using ==)
Result Details

Control V-71999
Title The Red Hat Enterprise Linux operating system security patches and updates must be installed and up to date.
Desc Timely patching is critical for maintaining the operational availability, confidentiality, and integrity of information technology (IT) systems. However, failure to keep operating system and application software patched is a common mistake made by IT professionals. New patches are released daily, and it is often difficult for even experienced System Administrators to keep abreast of all the new patches. When new weaknesses in an operating system exist, patches are usually made available by the vendor to resolve the problems. If the most recent security patches and updates are not installed, unauthorized users may take advantage of weaknesses in the unpatched software. The lack of prompt attention to patching could result in a system compromise.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the operating system security patches and updates are installed and up to date. Updates are required to be applied with a frequency determined by the site or Program Management Office (PMO). Obtain the list of available package security updates from Red Hat. The URL for updates is https://rhn.redhat.com/errata/. It is important to note that updates provided by Red Hat may not be present on the system if the underlying packages are not installed. Check that the available package security updates have been installed on the system with the following command: # yum history list | more Loaded plugins: langpacks, product-id, subscription-manager ID | Command line | Date and time | Action(s) | Altered ------------------------------------------------------------------------------- 70 | install aide | 2016-05-05 10:58 | Install | 1 69 | update -y | 2016-05-04 14:34 | Update | 18 EE 68 | install vlc | 2016-04-21 17:12 | Install | 21 67 | update -y | 2016-04-21 17:04 | Update | 7 EE 66 | update -y | 2016-04-15 16:47 | E, I, U | 84 EE If package updates have not been performed on the system within the timeframe that the site/program documentation requires, this is a finding. Typical update frequency may be overridden by Information Assurance Vulnerability Alert (IAVA) notifications from CYBERCOM. If the operating system is in non-compliance with the Information Assurance Vulnerability Management (IAVM) process, this is a finding.
Fix Text Install the operating system patches or updated packages available from Red Hat within 30 days or sooner as local policy dictates.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71999" do title "The Red Hat Enterprise Linux operating system security patches and updates must be installed and up to date." desc "Timely patching is critical for maintaining the operational availability, confidentiality, and integrity of information technology (IT) systems. However, failure to keep operating system and application software patched is a common mistake made by IT professionals. New patches are released daily, and it is often difficult for even experienced System Administrators to keep abreast of all the new patches. When new weaknesses in an operating system exist, patches are usually made available by the vendor to resolve the problems. If the most recent security patches and updates are not installed, unauthorized users may take advantage of weaknesses in the unpatched software. The lack of prompt attention to patching could result in a system compromise." desc "rationale", "" desc "check", " Verify the operating system security patches and updates are installed and up to date. Updates are required to be applied with a frequency determined by the site or Program Management Office (PMO). Obtain the list of available package security updates from Red Hat. The URL for updates is https://rhn.redhat.com/errata/. It is important to note that updates provided by Red Hat may not be present on the system if the underlying packages are not installed. Check that the available package security updates have been installed on the system with the following command: # yum history list | more Loaded plugins: langpacks, product-id, subscription-manager ID | Command line | Date and time | Action(s) | Altered ------------------------------------------------------------------------------- 70 | install aide | 2016-05-05 10:58 | Install | 1 69 | update -y | 2016-05-04 14:34 | Update | 18 EE 68 | install vlc | 2016-04-21 17:12 | Install | 21 67 | update -y | 2016-04-21 17:04 | Update | 7 EE 66 | update -y | 2016-04-15 16:47 | E, I, U | 84 EE If package updates have not been performed on the system within the timeframe that the site/program documentation requires, this is a finding. Typical update frequency may be overridden by Information Assurance Vulnerability Alert (IAVA) notifications from CYBERCOM. If the operating system is in non-compliance with the Information Assurance Vulnerability Management (IAVM) process, this is a finding. " desc "fix", "Install the operating system patches or updated packages available from Red Hat within 30 days or sooner as local policy dictates." impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-71999" tag rid: "SV-86623r4_rule" tag stig_id: "RHEL-07-020260" tag fix_id: "F-78351r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] updates = linux_update.updates package_names = updates.map { |h| h['name'] } describe.one do describe 'List of out-of-date packages' do subject { package_names } it { should be_empty } end updates.each do |update| describe package(update['name']) do its('version') { should eq update['version'] } end end end end
File integrity tools use cryptographic hashes for verifying file contents and directories have not been altered. These hashes must be FIPS 140-2 approved cryptographic hashes.
Test Results

Status passed
Test System Package aide is expected to be installed
Result
Status passed
Test List of monitored files/directories without 'sha512' rule is expected to be empty
Result expected `["/root/\\..*", "/var/log/faillog$", "/var/log/lastlog$", "/var/run/faillock", "/var/log", "/var/run/utmp$", "/etc"].empty?` to return true, got false
Result Details

Control V-72073
Title The Red Hat Enterprise Linux operating system must use a file integrity tool that is configured to use FIPS 140-2 approved cryptographic hashes for validating file contents and directories.
Desc File integrity tools use cryptographic hashes for verifying file contents and directories have not been altered. These hashes must be FIPS 140-2 approved cryptographic hashes.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the file integrity tool is configured to use FIPS 140-2 approved cryptographic hashes for validating file contents and directories. Note: If RHEL-07-021350 is a finding, this is automatically a finding too as the system cannot implement FIPS 140-2 approved cryptographic algorithms and hashes. Check to see if Advanced Intrusion Detection Environment (AIDE) is installed on the system with the following command: # yum list installed aide If AIDE is not installed, ask the System Administrator how file integrity checks are performed on the system. If there is no application installed to perform file integrity checks, this is a finding. Note: AIDE is highly configurable at install time. These commands assume the "aide.conf" file is under the "/etc" directory. Use the following command to determine if the file is in another location: # find / -name aide.conf Check the "aide.conf" file to determine if the "sha512" rule has been added to the rule list being applied to the files and directories selection lists. An example rule that includes the "sha512" rule follows: All=p+i+n+u+g+s+m+S+sha512+acl+xattrs+selinux /bin All # apply the custom rule to the files in bin /sbin All # apply the same custom rule to the files in sbin If the "sha512" rule is not being used on all uncommented selection lines in the "/etc/aide.conf" file, or another file integrity tool is not using FIPS 140-2 approved cryptographic hashes for validating file contents and directories, this is a finding.
Fix Text Configure the file integrity tool to use FIPS 140-2 cryptographic hashes for validating file and directory contents. If AIDE is installed, ensure the "sha512" rule is present on all uncommented file and directory selection lists.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72073" do title "The Red Hat Enterprise Linux operating system must use a file integrity tool that is configured to use FIPS 140-2 approved cryptographic hashes for validating file contents and directories." desc "File integrity tools use cryptographic hashes for verifying file contents and directories have not been altered. These hashes must be FIPS 140-2 approved cryptographic hashes." desc "rationale", "" desc "check", " Verify the file integrity tool is configured to use FIPS 140-2 approved cryptographic hashes for validating file contents and directories. Note: If RHEL-07-021350 is a finding, this is automatically a finding too as the system cannot implement FIPS 140-2 approved cryptographic algorithms and hashes. Check to see if Advanced Intrusion Detection Environment (AIDE) is installed on the system with the following command: # yum list installed aide If AIDE is not installed, ask the System Administrator how file integrity checks are performed on the system. If there is no application installed to perform file integrity checks, this is a finding. Note: AIDE is highly configurable at install time. These commands assume the \"aide.conf\" file is under the \"/etc\" directory. Use the following command to determine if the file is in another location: # find / -name aide.conf Check the \"aide.conf\" file to determine if the \"sha512\" rule has been added to the rule list being applied to the files and directories selection lists. An example rule that includes the \"sha512\" rule follows: All=p+i+n+u+g+s+m+S+sha512+acl+xattrs+selinux /bin All # apply the custom rule to the files in bin /sbin All # apply the same custom rule to the files in sbin If the \"sha512\" rule is not being used on all uncommented selection lines in the \"/etc/aide.conf\" file, or another file integrity tool is not using FIPS 140-2 approved cryptographic hashes for validating file contents and directories, this is a finding. " desc "fix", " Configure the file integrity tool to use FIPS 140-2 cryptographic hashes for validating file and directory contents. If AIDE is installed, ensure the \"sha512\" rule is present on all uncommented file and directory selection lists. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72073" tag rid: "SV-86697r3_rule" tag stig_id: "RHEL-07-021620" tag fix_id: "F-78425r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe package("aide") do it { should be_installed } end exclude_patterns = input('aide_exclude_patterns') findings = aide_conf.where { !selection_line.start_with?('!') && !exclude_patterns.include?(selection_line) && !rules.include?('sha512')} describe "List of monitored files/directories without 'sha512' rule" do subject { findings.selection_lines } it { should be_empty } end end
Display of a standardized and approved use notification before granting access to the operating system ensures privacy and security notification verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. System use notifications are required only for access via logon interfaces with human users and are not required when such human interfaces do not exist. The banner must be formatted in accordance with applicable DoD policy. Use the following verbiage for operating systems that can accommodate banners of 1300 characters: "You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. By using this IS (which includes any device attached to this IS), you consent to the following conditions: -The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations. -At any time, the USG may inspect and seize data stored on this IS. -Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose. -This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy. -Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details."
Test Results

Status passed
Test The banner text should match the standard banner is expected to cmp == "YouareaccessingaU.S.Government(USG)InformationSystem(IS)thatisprovidedforUSG-authorizeduseonly.ByusingthisIS(whichincludesanydeviceattachedtothisIS),youconsenttothefollowingconditions:-TheUSGroutinelyinterceptsandmonitorscommunicationsonthisISforpurposesincluding,butnotlimitedto,penetrationtesting,COMSECmonitoring,networkoperationsanddefense,personnelmisconduct(PM),lawenforcement(LE),andcounterintelligence(CI)investigations.-Atanytime,theUSGmayinspectandseizedatastoredonthisIS.-Communicationsusing,ordatastoredon,thisISarenotprivate,aresubjecttoroutinemonitoring,interception,andsearch,andmaybedisclosedorusedforanyUSG-authorizedpurpose.-ThisISincludessecuritymeasures(e.g.,authenticationandaccesscontrols)toprotectUSGinterests--notforyourpersonalbenefitorprivacy.-Notwithstandingtheabove,usingthisISdoesnotconstituteconsenttoPM,LEorCIinvestigativesearchingormonitoringofthecontentofprivilegedcommunications,orworkproduct,relatedtopersonalrepresentationorservicesbyattorneys,psychotherapists,orclergy,andtheirassistants.Suchcommunicationsandworkproductareprivateandconfidential.SeeUserAgreementfordetails."
Result expected: YouareaccessingaU.S.Government(USG)InformationSystem(IS)thatisprovidedforUSG-authorizeduseonly.ByusingthisIS(whichincludesanydeviceattachedtothisIS),youconsenttothefollowingconditions:-TheUSGroutinelyinterceptsandmonitorscommunicationsonthisISforpurposesincluding,butnotlimitedto,penetrationtesting,COMSECmonitoring,networkoperationsanddefense,personnelmisconduct(PM),lawenforcement(LE),andcounterintelligence(CI)investigations.-Atanytime,theUSGmayinspectandseizedatastoredonthisIS.-Communicationsusing,ordatastoredon,thisISarenotprivate,aresubjecttoroutinemonitoring,interception,andsearch,andmaybedisclosedorusedforanyUSG-authorizedpurpose.-ThisISincludessecuritymeasures(e.g.,authenticationandaccesscontrols)toprotectUSGinterests--notforyourpersonalbenefitorprivacy.-Notwithstandingtheabove,usingthisISdoesnotconstituteconsenttoPM,LEorCIinvestigativesearchingormonitoringofthecontentofprivilegedcommunications,orworkproduct,relatedtopersonalrepresentationorservicesbyattorneys,psychotherapists,orclergy,andtheirassistants.Suchcommunicationsandworkproductareprivateandconfidential.SeeUserAgreementfordetails. got: YouareaccessingaU.S.Government(USG)informationsystem(IS)thatisprovidedforUSG-authorizeduseonly.ByusingthisIS(whichincludesanydeviceattachedtothisIS)youconsenttothefollowingconditions:-TheUSGroutinelyinterceptsandmonitorscommunicationsonthisISforpurposesincluding,butnotlimitedto,penetrationtesting,COMSECmonitoring,networkoperationsanddefense,personnelmisconduct(PM),lawenforcement(LE),andcounterintelligence(CI)investigations.-Atanytime,theUSGmayinspectandseizedatastoredonthisIS.-Communicationsusing,ordatastoredon,thisISarenotprivate,aresubjecttoroutinemonitoring,interception,andsearch,andmaybedisclosedorusedforanyUSG-authorizedpurpose.-ThisISincludessecuritymeasures(e.g.,authenticationandaccesscontrols)toprotectUSGinterests--notforyourpersonalbenefitorprivacy.-Notwithstandingtheabove,usingthisISdoesnotconstituteconsenttoPM,LEorCIinvestigativesearchingormonitoringofthecontentofprivilegedcommunications,orworkproduct,relatedtopersonalrepresentationorservicesbyattorneys,psychotherapists,orclergy,andtheirassistants.Suchcommunicationsandworkproductareprivateandconfidential.SeeUserAgreementfordetails. (compared using `cmp` matcher)
Status passed
Test The banner text should match the limited banner is expected to cmp == "I'veread&consenttotermsinISuseragreem't."
Result expected: I'veread&consenttotermsinISuseragreem't. got: YouareaccessingaU.S.Government(USG)informationsystem(IS)thatisprovidedforUSG-authorizeduseonly.ByusingthisIS(whichincludesanydeviceattachedtothisIS)youconsenttothefollowingconditions:-TheUSGroutinelyinterceptsandmonitorscommunicationsonthisISforpurposesincluding,butnotlimitedto,penetrationtesting,COMSECmonitoring,networkoperationsanddefense,personnelmisconduct(PM),lawenforcement(LE),andcounterintelligence(CI)investigations.-Atanytime,theUSGmayinspectandseizedatastoredonthisIS.-Communicationsusing,ordatastoredon,thisISarenotprivate,aresubjecttoroutinemonitoring,interception,andsearch,andmaybedisclosedorusedforanyUSG-authorizedpurpose.-ThisISincludessecuritymeasures(e.g.,authenticationandaccesscontrols)toprotectUSGinterests--notforyourpersonalbenefitorprivacy.-Notwithstandingtheabove,usingthisISdoesnotconstituteconsenttoPM,LEorCIinvestigativesearchingormonitoringofthecontentofprivilegedcommunications,orworkproduct,relatedtopersonalrepresentationorservicesbyattorneys,psychotherapists,orclergy,andtheirassistants.Suchcommunicationsandworkproductareprivateandconfidential.SeeUserAgreementfordetails. (compared using `cmp` matcher)
Result Details

Control V-71863
Title The Red Hat Enterprise Linux operating system must display the Standard Mandatory DoD Notice and Consent Banner before granting local or remote access to the system via a command line user logon.
Desc Display of a standardized and approved use notification before granting access to the operating system ensures privacy and security notification verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. System use notifications are required only for access via logon interfaces with human users and are not required when such human interfaces do not exist. The banner must be formatted in accordance with applicable DoD policy. Use the following verbiage for operating systems that can accommodate banners of 1300 characters: "You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. By using this IS (which includes any device attached to this IS), you consent to the following conditions: -The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations. -At any time, the USG may inspect and seize data stored on this IS. -Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose. -This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy. -Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details."
Severity medium
Impact 0.5
Nist Controls AC-8 a, Rev_4
Check Text Verify the operating system displays the Standard Mandatory DoD Notice and Consent Banner before granting access to the operating system via a command line user logon. Check to see if the operating system displays a banner at the command line logon screen with the following command: # more /etc/issue The command should return the following text: "You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. By using this IS (which includes any device attached to this IS), you consent to the following conditions: -The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations. -At any time, the USG may inspect and seize data stored on this IS. -Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose. -This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy. -Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details." If the operating system does not display a graphical logon banner or the banner does not match the Standard Mandatory DoD Notice and Consent Banner, this is a finding. If the text in the "/etc/issue" file does not match the Standard Mandatory DoD Notice and Consent Banner, this is a finding.
Fix Text Configure the operating system to display the Standard Mandatory DoD Notice and Consent Banner before granting access to the system via the command line by editing the "/etc/issue" file. Replace the default text with the Standard Mandatory DoD Notice and Consent Banner. The DoD required text is: "You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. By using this IS (which includes any device attached to this IS), you consent to the following conditions: -The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations. -At any time, the USG may inspect and seize data stored on this IS. -Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose. -This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy. -Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details."

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71863" do title "The Red Hat Enterprise Linux operating system must display the Standard Mandatory DoD Notice and Consent Banner before granting local or remote access to the system via a command line user logon." desc "Display of a standardized and approved use notification before granting access to the operating system ensures privacy and security notification verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. System use notifications are required only for access via logon interfaces with human users and are not required when such human interfaces do not exist. The banner must be formatted in accordance with applicable DoD policy. Use the following verbiage for operating systems that can accommodate banners of 1300 characters: \"You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. By using this IS (which includes any device attached to this IS), you consent to the following conditions: -The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations. -At any time, the USG may inspect and seize data stored on this IS. -Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose. -This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy. -Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details.\" " desc "rationale", "" desc "check", " Verify the operating system displays the Standard Mandatory DoD Notice and Consent Banner before granting access to the operating system via a command line user logon. Check to see if the operating system displays a banner at the command line logon screen with the following command: # more /etc/issue The command should return the following text: \"You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. By using this IS (which includes any device attached to this IS), you consent to the following conditions: -The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations. -At any time, the USG may inspect and seize data stored on this IS. -Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose. -This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy. -Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details.\" If the operating system does not display a graphical logon banner or the banner does not match the Standard Mandatory DoD Notice and Consent Banner, this is a finding. If the text in the \"/etc/issue\" file does not match the Standard Mandatory DoD Notice and Consent Banner, this is a finding. " desc "fix", " Configure the operating system to display the Standard Mandatory DoD Notice and Consent Banner before granting access to the system via the command line by editing the \"/etc/issue\" file. Replace the default text with the Standard Mandatory DoD Notice and Consent Banner. The DoD required text is: \"You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. By using this IS (which includes any device attached to this IS), you consent to the following conditions: -The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations. -At any time, the USG may inspect and seize data stored on this IS. -Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose. -This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy. -Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details.\" " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000023-GPOS-00006" tag satisfies: ["SRG-OS-000023-GPOS-00006", "SRG-OS-000024-GPOS-00007"] tag gid: "V-71863" tag rid: "SV-86487r3_rule" tag stig_id: "RHEL-07-010050" tag fix_id: "F-78217r2_fix" tag cci: ["CCI-000048"] tag nist: ["AC-8 a", "Rev_4"] banner_message_text_cli = input('banner_message_text_cli') banner_message_text_cli_limited = input('banner_message_text_cli_limited') clean_banner = banner_message_text_cli.gsub(%r{[\r\n\s]}, '') clean_banner_limited = banner_message_text_cli_limited.gsub(%r{[\r\n\s]}, '') banner_file = file("/etc/issue") banner_missing = !banner_file.exist? describe "The banner text is not set because /etc/issue does not exist" do subject { banner_missing } it { should be false } end if banner_missing banner_message = banner_file.content.gsub(%r{[\r\n\s]}, '') describe.one do describe "The banner text should match the standard banner" do subject { banner_message } it { should cmp clean_banner } end describe "The banner text should match the limited banner" do subject { banner_message } it{should cmp clean_banner_limited } end end if !banner_missing end
Source-routed packets allow the source of the packet to suggest that routers forward the packet along a different path than configured on the router, which can be used to bypass network security measures. This requirement applies only to the forwarding of source-routed traffic, such as when IPv6 forwarding is enabled and the system is functioning as a router.
Test Results

Status passed
Test Kernel Parameter net.ipv6.conf.all.accept_source_route value is expected to eq 0
Result
Result Details

Control V-72319
Title The Red Hat Enterprise Linux operating system must not forward IPv6 source-routed packets.
Desc Source-routed packets allow the source of the packet to suggest that routers forward the packet along a different path than configured on the router, which can be used to bypass network security measures. This requirement applies only to the forwarding of source-routed traffic, such as when IPv6 forwarding is enabled and the system is functioning as a router.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text If IPv6 is not enabled, the key will not exist, and this is Not Applicable. Verify the system does not accept IPv6 source-routed packets. # grep net.ipv6.conf.all.accept_source_route /etc/sysctl.conf /etc/sysctl.d/* net.ipv6.conf.all.accept_source_route = 0 If "net.ipv6.conf.all.accept_source_route" is not configured in the /etc/sysctl.conf file or in the /etc/sysctl.d/ directory, is commented out or does not have a value of "0", this is a finding. Check that the operating system implements the accept source route variable with the following command: # /sbin/sysctl -a | grep net.ipv6.conf.all.accept_source_route net.ipv6.conf.all.accept_source_route = 0 If the returned lines do not have a value of "0", this is a finding.
Fix Text Set the system to the required kernel parameter, if IPv6 is enabled, by adding the following line to "/etc/sysctl.conf" or a configuration file in the /etc/sysctl.d/ directory (or modify the line to have the required value): net.ipv6.conf.all.accept_source_route = 0 Issue the following command to make the changes take effect: # sysctl --system

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72319" do title "The Red Hat Enterprise Linux operating system must not forward IPv6 source-routed packets." desc "Source-routed packets allow the source of the packet to suggest that routers forward the packet along a different path than configured on the router, which can be used to bypass network security measures. This requirement applies only to the forwarding of source-routed traffic, such as when IPv6 forwarding is enabled and the system is functioning as a router." desc "rationale", "" desc "check", " If IPv6 is not enabled, the key will not exist, and this is Not Applicable. Verify the system does not accept IPv6 source-routed packets. # grep net.ipv6.conf.all.accept_source_route /etc/sysctl.conf /etc/sysctl.d/* net.ipv6.conf.all.accept_source_route = 0 If \"net.ipv6.conf.all.accept_source_route\" is not configured in the /etc/sysctl.conf file or in the /etc/sysctl.d/ directory, is commented out or does not have a value of \"0\", this is a finding. Check that the operating system implements the accept source route variable with the following command: # /sbin/sysctl -a | grep net.ipv6.conf.all.accept_source_route net.ipv6.conf.all.accept_source_route = 0 If the returned lines do not have a value of \"0\", this is a finding. " desc "fix", " Set the system to the required kernel parameter, if IPv6 is enabled, by adding the following line to \"/etc/sysctl.conf\" or a configuration file in the /etc/sysctl.d/ directory (or modify the line to have the required value): net.ipv6.conf.all.accept_source_route = 0 Issue the following command to make the changes take effect: # sysctl --system " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72319" tag rid: "SV-86943r2_rule" tag stig_id: "RHEL-07-040830" tag fix_id: "F-78673r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe.one do describe kernel_parameter('net.ipv6.conf.all.accept_source_route') do its('value') { should eq 0 } end # If IPv6 is disabled in the kernel it will return NIL describe kernel_parameter('net.ipv6.conf.all.accept_source_route') do its('value') { should eq nil } end end end
Without cryptographic integrity protections, information can be altered by unauthorized users without detection. Cryptographic mechanisms used for protecting the integrity of information include, for example, signed hash functions using asymmetric cryptography enabling distribution of the public key to verify the hash information while maintaining the confidentiality of the key used to generate the hash.
Test Results

Status skipped
Test LDAP not enabled
Result
Result Details

Control V-72229
Title The Red Hat Enterprise Linux operating system must implement cryptography to protect the integrity of Lightweight Directory Access Protocol (LDAP) communications.
Desc Without cryptographic integrity protections, information can be altered by unauthorized users without detection. Cryptographic mechanisms used for protecting the integrity of information include, for example, signed hash functions using asymmetric cryptography enabling distribution of the public key to verify the hash information while maintaining the confidentiality of the key used to generate the hash.
Severity none
Nist Controls AC-17 (2), Rev_4
Check Text If LDAP is not being utilized, this requirement is Not Applicable. Verify the operating system implements cryptography to protect the integrity of remote LDAP access sessions. To determine if LDAP is being used for authentication, use the following command: # systemctl status sssd.service sssd.service - System Security Services Daemon Loaded: loaded (/usr/lib/systemd/system/sssd.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2018-06-27 10:58:11 EST; 1h 50min ago If the "sssd.service" is "active", then LDAP is being used. Determine the "id_provider" the LDAP is currently using: # grep -i "id_provider" /etc/sssd/sssd.conf id_provider = ad If "id_provider" is set to "ad", this is Not Applicable. Verify the sssd service is configured to require the use of certificates: # grep -i tls_reqcert /etc/sssd/sssd.conf ldap_tls_reqcert = demand If the "ldap_tls_reqcert" setting is missing, commented out, or does not exist, this is a finding. If the "ldap_tls_reqcert" setting is not set to "demand" or "hard", this is a finding.
Fix Text Configure the operating system to implement cryptography to protect the integrity of LDAP remote access sessions. Add or modify the following line in "/etc/sssd/sssd.conf": ldap_tls_reqcert = demand

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72229" do title "The Red Hat Enterprise Linux operating system must implement cryptography to protect the integrity of Lightweight Directory Access Protocol (LDAP) communications." desc "Without cryptographic integrity protections, information can be altered by unauthorized users without detection. Cryptographic mechanisms used for protecting the integrity of information include, for example, signed hash functions using asymmetric cryptography enabling distribution of the public key to verify the hash information while maintaining the confidentiality of the key used to generate the hash. " desc "rationale", "" desc "check", " If LDAP is not being utilized, this requirement is Not Applicable. Verify the operating system implements cryptography to protect the integrity of remote LDAP access sessions. To determine if LDAP is being used for authentication, use the following command: # systemctl status sssd.service sssd.service - System Security Services Daemon Loaded: loaded (/usr/lib/systemd/system/sssd.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2018-06-27 10:58:11 EST; 1h 50min ago If the \"sssd.service\" is \"active\", then LDAP is being used. Determine the \"id_provider\" the LDAP is currently using: # grep -i \"id_provider\" /etc/sssd/sssd.conf id_provider = ad If \"id_provider\" is set to \"ad\", this is Not Applicable. Verify the sssd service is configured to require the use of certificates: # grep -i tls_reqcert /etc/sssd/sssd.conf ldap_tls_reqcert = demand If the \"ldap_tls_reqcert\" setting is missing, commented out, or does not exist, this is a finding. If the \"ldap_tls_reqcert\" setting is not set to \"demand\" or \"hard\", this is a finding. " desc "fix", " Configure the operating system to implement cryptography to protect the integrity of LDAP remote access sessions. Add or modify the following line in \"/etc/sssd/sssd.conf\": ldap_tls_reqcert = demand " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000250-GPOS-00093" tag gid: "V-72229" tag rid: "SV-86853r4_rule" tag stig_id: "RHEL-07-040190" tag fix_id: "F-78583r4_fix" tag cci: ["CCI-001453"] tag nist: ["AC-17 (2)", "Rev_4"] sssd_id_ldap_enabled = (package('sssd').installed? and !command('grep "^\s*id_provider\s*=\s*ldap" /etc/sssd/sssd.conf').stdout.strip.empty?) sssd_ldap_enabled = (package('sssd').installed? and !command('grep "^\s*[a-z]*_provider\s*=\s*ldap" /etc/sssd/sssd.conf').stdout.strip.empty?) pam_ldap_enabled = (!command('grep "^[^#]*pam_ldap\.so" /etc/pam.d/*').stdout.strip.empty?) if !(sssd_id_ldap_enabled or sssd_ldap_enabled or pam_ldap_enabled) impact 0.0 describe "LDAP not enabled" do skip "LDAP not enabled using any known mechanisms, this control is Not Applicable." end end if sssd_id_ldap_enabled ldap_id_use_start_tls = command('grep ldap_id_use_start_tls /etc/sssd/sssd.conf') describe ldap_id_use_start_tls do its('stdout.strip') { should match %r{^ldap_id_use_start_tls\s*=\s*true$}} end ldap_id_use_start_tls.stdout.strip.each_line do |line| describe line do it { should match %r{^ldap_id_use_start_tls\s*=\s*true$}} end end end if sssd_ldap_enabled ldap_tls_cacertdir = command('grep -i ldap_tls_cacertdir /etc/sssd/sssd.conf'). stdout.strip.scan(%r{^ldap_tls_cacertdir\s*=\s*(.*)}).last describe "ldap_tls_cacertdir" do subject { ldap_tls_cacertdir } it { should_not eq nil } end describe file(ldap_tls_cacertdir.last) do it { should exist } it { should be_directory } end if !ldap_tls_cacertdir.nil? end if pam_ldap_enabled tls_cacertdir = command('grep -i tls_cacertdir /etc/pam_ldap.conf'). stdout.strip.scan(%r{^tls_cacertdir\s+(.*)}).last describe "tls_cacertdir" do subject { tls_cacertdir } it { should_not eq nil } end describe file(tls_cacertdir.last) do it { should exist } it { should be_directory } end if !tls_cacertdir.nil? end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with syscall == "fchownat" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "fchownat" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "fchownat" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "fchownat" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Result Details

Control V-72103
Title The Red Hat Enterprise Linux operating system must audit all uses of the fchownat syscall.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-2 d, AU-12 c, Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "fchownat" syscall occur. Check the file system rules in "/etc/audit/audit.rules" with the following commands: # grep -iw fchownat /etc/audit/audit.rules -a always,exit -F arch=b32 -S fchownat -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S fchownat -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the "b32" and "b64" audit rules are not defined for the "fchownat" syscall, this is a finding.
Fix Text Add or update the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S fchownat -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S fchownat -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72103" do title "The Red Hat Enterprise Linux operating system must audit all uses of the fchownat syscall." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"fchownat\" syscall occur. Check the file system rules in \"/etc/audit/audit.rules\" with the following commands: # grep -iw fchownat /etc/audit/audit.rules -a always,exit -F arch=b32 -S fchownat -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S fchownat -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the \"b32\" and \"b64\" audit rules are not defined for the \"fchownat\" syscall, this is a finding. " desc "fix", " Add or update the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S fchownat -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S fchownat -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000064-GPOS-00033" tag satisfies: ["SRG-OS-000064-GPOS-00033", "SRG-OS-000392-GPOS-00172", "SRG-OS-000458-GPOS-00203", "SRG-OS-000474-GPOS-00219"] tag gid: "V-72103" tag rid: "SV-86727r5_rule" tag stig_id: "RHEL-07-030400" tag fix_id: "F-78455r7_fix" tag cci: ["CCI-000126", "CCI-000172"] tag nist: ["AU-2 d", "AU-12 c", "Rev_4"] describe auditd.syscall("fchownat").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end if os.arch == 'x86_64' describe auditd.syscall("fchownat").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end end end
It is detrimental for operating systems to provide, or install by default, functionality exceeding requirements or mission objectives. These unnecessary capabilities or services are often overlooked and therefore may remain unsecured. They increase the risk to the platform by providing additional attack vectors. Operating systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions). Examples of non-essential capabilities include, but are not limited to, games, software packages, tools, and demonstration software not related to requirements or providing a wide array of functionality not required for every mission, but which cannot be disabled.
Test Results

Status passed
Test System Package telnet-server is expected not to be installed
Result
Result Details

Control V-72077
Title The Red Hat Enterprise Linux operating system must not have the telnet-server package installed.
Desc It is detrimental for operating systems to provide, or install by default, functionality exceeding requirements or mission objectives. These unnecessary capabilities or services are often overlooked and therefore may remain unsecured. They increase the risk to the platform by providing additional attack vectors. Operating systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions). Examples of non-essential capabilities include, but are not limited to, games, software packages, tools, and demonstration software not related to requirements or providing a wide array of functionality not required for every mission, but which cannot be disabled.
Severity high
Impact 0.7
Nist Controls CM-7 a, Rev_4
Check Text Verify the operating system is configured to disable non-essential capabilities. The most secure way of ensuring a non-essential capability is disabled is to not have the capability installed. The telnet service provides an unencrypted remote access service that does not provide for the confidentiality and integrity of user passwords or the remote session. If a privileged user were to log on using this service, the privileged user password could be compromised. Check to see if the telnet-server package is installed with the following command: # yum list installed telnet-server If the telnet-server package is installed, this is a finding.
Fix Text Configure the operating system to disable non-essential capabilities by removing the telnet-server package from the system with the following command: # yum remove telnet-server

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72077" do title "The Red Hat Enterprise Linux operating system must not have the telnet-server package installed." desc "It is detrimental for operating systems to provide, or install by default, functionality exceeding requirements or mission objectives. These unnecessary capabilities or services are often overlooked and therefore may remain unsecured. They increase the risk to the platform by providing additional attack vectors. Operating systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions). Examples of non-essential capabilities include, but are not limited to, games, software packages, tools, and demonstration software not related to requirements or providing a wide array of functionality not required for every mission, but which cannot be disabled. " desc "rationale", "" desc "check", " Verify the operating system is configured to disable non-essential capabilities. The most secure way of ensuring a non-essential capability is disabled is to not have the capability installed. The telnet service provides an unencrypted remote access service that does not provide for the confidentiality and integrity of user passwords or the remote session. If a privileged user were to log on using this service, the privileged user password could be compromised. Check to see if the telnet-server package is installed with the following command: # yum list installed telnet-server If the telnet-server package is installed, this is a finding. " desc "fix", " Configure the operating system to disable non-essential capabilities by removing the telnet-server package from the system with the following command: # yum remove telnet-server " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000095-GPOS-00049" tag gid: "V-72077" tag rid: "SV-86701r2_rule" tag stig_id: "RHEL-07-021710" tag fix_id: "F-78429r1_fix" tag cci: ["CCI-000381"] tag nist: ["CM-7 a", "Rev_4"] describe package('telnet-server') do it { should_not be_installed } end end
Without re-authentication, users may access resources or perform tasks for which they do not have authorization. When operating systems provide the capability to escalate a functional capability, it is critical the user reauthenticate.
Test Results

Status passed
Test Command: `grep -ir authenticate /etc/sudoers /etc/sudoers.d/*` stdout is expected not to match /!authenticate/
Result
Result Details

Control V-71949
Title The Red Hat Enterprise Linux operating system must be configured so that users must re-authenticate for privilege escalation.
Desc Without re-authentication, users may access resources or perform tasks for which they do not have authorization. When operating systems provide the capability to escalate a functional capability, it is critical the user reauthenticate.
Severity medium
Impact 0.5
Nist Controls IA-11, Rev_4
Check Text Verify the operating system requires users to reauthenticate for privilege escalation. Check the configuration of the "/etc/sudoers" and "/etc/sudoers.d/*" files with the following command: # grep -i authenticate /etc/sudoers /etc/sudoers.d/* If any uncommented line is found with a "!authenticate" tag, this is a finding.
Fix Text Configure the operating system to require users to reauthenticate for privilege escalation. Check the configuration of the "/etc/sudoers" file with the following command: # visudo Remove any occurrences of "!authenticate" tags in the file. Check the configuration of the "/etc/sudoers.d/*" files with the following command: # grep -i authenticate /etc/sudoers /etc/sudoers.d/* Remove any occurrences of "!authenticate" tags in the file(s).

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71949" do title "The Red Hat Enterprise Linux operating system must be configured so that users must re-authenticate for privilege escalation." desc "Without re-authentication, users may access resources or perform tasks for which they do not have authorization. When operating systems provide the capability to escalate a functional capability, it is critical the user reauthenticate. " desc "rationale", "" desc "check", " Verify the operating system requires users to reauthenticate for privilege escalation. Check the configuration of the \"/etc/sudoers\" and \"/etc/sudoers.d/*\" files with the following command: # grep -i authenticate /etc/sudoers /etc/sudoers.d/* If any uncommented line is found with a \"!authenticate\" tag, this is a finding. " desc "fix", " Configure the operating system to require users to reauthenticate for privilege escalation. Check the configuration of the \"/etc/sudoers\" file with the following command: # visudo Remove any occurrences of \"!authenticate\" tags in the file. Check the configuration of the \"/etc/sudoers.d/*\" files with the following command: # grep -i authenticate /etc/sudoers /etc/sudoers.d/* Remove any occurrences of \"!authenticate\" tags in the file(s). " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000373-GPOS-00156" tag satisfies: ["SRG-OS-000373-GPOS-00156", "SRG-OS-000373-GPOS-00157", "SRG-OS-000373-GPOS-00158"] tag gid: "V-71949" tag rid: "SV-86573r3_rule" tag stig_id: "RHEL-07-010350" tag fix_id: "F-78301r3_fix" tag cci: ["CCI-002038"] tag nist: ["IA-11", "Rev_4"] describe command("grep -ir authenticate /etc/sudoers /etc/sudoers.d/*") do its('stdout') { should_not match %r{!authenticate} } end end
Local initialization files are used to configure the user's shell environment upon logon. Malicious modification of these files could compromise accounts upon logon.
Test Results

Status passed
Test #<Set: {"/root/.bash_logout", "/root/.bash_profile", "/root/.bashrc", "/root/.cshrc", "/root/.tcshrc"}> is expected to be empty
Result expected `#<Set: {"/root/.bash_logout", "/root/.bash_profile", "/root/.bashrc", "/root/.cshrc", "/root/.tcshrc"}>.empty?` to return true, got false
Result Details

Control V-72033
Title The Red Hat Enterprise Linux operating system must be configured so that all local initialization files have mode 0740 or less permissive.
Desc Local initialization files are used to configure the user's shell environment upon logon. Malicious modification of these files could compromise accounts upon logon.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify that all local initialization files have a mode of "0740" or less permissive. Check the mode on all local initialization files with the following command: Note: The example will be for the "smithj" user, who has a home directory of "/home/smithj". # ls -al /home/smithj/.[^.]* | more -rwxr----- 1 smithj users 896 Mar 10 2011 .profile -rwxr----- 1 smithj users 497 Jan 6 2007 .login -rwxr----- 1 smithj users 886 Jan 6 2007 .something If any local initialization files have a mode more permissive than "0740", this is a finding.
Fix Text Set the mode of the local initialization files to "0740" with the following command: Note: The example will be for the "smithj" user, who has a home directory of "/home/smithj". # chmod 0740 /home/smithj/.[^.]*

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72033" do title "The Red Hat Enterprise Linux operating system must be configured so that all local initialization files have mode 0740 or less permissive." desc "Local initialization files are used to configure the user's shell environment upon logon. Malicious modification of these files could compromise accounts upon logon." desc "rationale", "" desc "check", " Verify that all local initialization files have a mode of \"0740\" or less permissive. Check the mode on all local initialization files with the following command: Note: The example will be for the \"smithj\" user, who has a home directory of \"/home/smithj\". # ls -al /home/smithj/.[^.]* | more -rwxr----- 1 smithj users 896 Mar 10 2011 .profile -rwxr----- 1 smithj users 497 Jan 6 2007 .login -rwxr----- 1 smithj users 886 Jan 6 2007 .something If any local initialization files have a mode more permissive than \"0740\", this is a finding. " desc "fix", " Set the mode of the local initialization files to \"0740\" with the following command: Note: The example will be for the \"smithj\" user, who has a home directory of \"/home/smithj\". # chmod 0740 /home/smithj/.[^.]* " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72033" tag rid: "SV-86657r3_rule" tag stig_id: "RHEL-07-020710" tag fix_id: "F-78385r4_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] exempt_home_users = input('exempt_home_users') non_interactive_shells = input('non_interactive_shells') ignore_shells = non_interactive_shells.join('|') findings = Set[] users.where{ !shell.match(ignore_shells) && (uid >= 1000 || uid == 0)}.entries.each do |user_info| findings = findings + command("find #{user_info.home} -xdev -maxdepth 1 -name '.*' -type f -perm /037").stdout.split("\n") end describe findings do it { should be_empty } end end
Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised.
Test Results

Status passed
Test Parse Config File /etc/security/pwquality.conf difok.to_i is expected to cmp >= 8
Result
Result Details

Control V-71911
Title The Red Hat Enterprise Linux operating system must be configured so that when passwords are changed a minimum of eight of the total number of characters must be changed.
Desc Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised.
Severity medium
Impact 0.5
Nist Controls IA-5 (1) (b), Rev_4
Check Text The "difok" option sets the number of characters in a password that must not be present in the old password. Check for the value of the "difok" option in "/etc/security/pwquality.conf" with the following command: # grep difok /etc/security/pwquality.conf difok = 8 If the value of "difok" is set to less than "8", this is a finding.
Fix Text Configure the operating system to require the change of at least eight of the total number of characters when passwords are changed by setting the "difok" option. Add the following line to "/etc/security/pwquality.conf" (or modify the line to have the required value): difok = 8

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71911" do title "The Red Hat Enterprise Linux operating system must be configured so that when passwords are changed a minimum of eight of the total number of characters must be changed." desc "Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised. " desc "rationale", "" desc "check", " The \"difok\" option sets the number of characters in a password that must not be present in the old password. Check for the value of the \"difok\" option in \"/etc/security/pwquality.conf\" with the following command: # grep difok /etc/security/pwquality.conf difok = 8 If the value of \"difok\" is set to less than \"8\", this is a finding. " desc "fix", " Configure the operating system to require the change of at least eight of the total number of characters when passwords are changed by setting the \"difok\" option. Add the following line to \"/etc/security/pwquality.conf\" (or modify the line to have the required value): difok = 8 " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000072-GPOS-00040" tag gid: "V-71911" tag rid: "SV-86535r2_rule" tag stig_id: "RHEL-07-010160" tag fix_id: "F-78263r1_fix" tag cci: ["CCI-000195"] tag nist: ["IA-5 (1) (b)", "Rev_4"] difok = input('difok') describe parse_config_file("/etc/security/pwquality.conf") do its('difok.to_i') { should cmp >= difok } end end
Inaccurate time stamps make it more difficult to correlate events and can lead to an inaccurate analysis. Determining the correct time a particular event occurred on a system is critical when conducting forensic analysis and investigating system events. Sources outside the configured acceptable allowance (drift) may be inaccurate. Synchronizing internal information system clocks provides uniformity of time stamps for information systems with multiple system clocks and systems connected over a network. Organizations should consider endpoints that may not have regular access to the authoritative time server (e.g., mobile, teleworking, and tactical endpoints).
Test Results

Status passed
Test Service chronyd is expected to be running
Result
Status passed
Test Service chronyd is expected to be enabled
Result
Status passed
Test Service chronyd is expected to be installed
Result
Status passed
Test chronyd time sources list is expected not to be empty
Result
Status passed
Test chronyd maxpoll values (99=maxpoll absent) is expected to all be < 17
Result
Result Details

Control V-72269
Title The Red Hat Enterprise Linux operating system must, for networked systems, synchronize clocks with a server that is synchronized to one of the redundant United States Naval Observatory (USNO) time servers, a time server designated for the appropriate DoD network (NIPRNet/SIPRNet), and/or the Global Positioning System (GPS).
Desc Inaccurate time stamps make it more difficult to correlate events and can lead to an inaccurate analysis. Determining the correct time a particular event occurred on a system is critical when conducting forensic analysis and investigating system events. Sources outside the configured acceptable allowance (drift) may be inaccurate. Synchronizing internal information system clocks provides uniformity of time stamps for information systems with multiple system clocks and systems connected over a network. Organizations should consider endpoints that may not have regular access to the authoritative time server (e.g., mobile, teleworking, and tactical endpoints).
Severity medium
Impact 0.5
Nist Controls AU-8 (1) (a), AU-8 (1) (b), Rev_4
Check Text Check to see if NTP is running in continuous mode: # ps -ef | grep ntp If NTP is not running, check to see if "chronyd" is running in continuous mode: # ps -ef | grep chronyd If NTP or "chronyd" is not running, this is a finding. If the NTP process is found, then check the "ntp.conf" file for the "maxpoll" option setting: # grep maxpoll /etc/ntp.conf server 0.rhel.pool.ntp.org iburst maxpoll 10 If the option is set to "17" or is not set, this is a finding. If the file does not exist, check the "/etc/cron.daily" subdirectory for a crontab file controlling the execution of the "ntpd -q" command. # grep -i "ntpd -q" /etc/cron.daily/* # ls -al /etc/cron.* | grep ntp ntp If a crontab file does not exist in the "/etc/cron.daily" that executes the "ntpd -q" command, this is a finding. If the "chronyd" process is found, then check the "chrony.conf" file for the "maxpoll" option setting: # grep maxpoll /etc/chrony.conf server 0.rhel.pool.ntp.org iburst maxpoll 10 If the option is not set or the line is commented out, this is a finding.
Fix Text Edit the "/etc/ntp.conf" or "/etc/chrony.conf" file and add or update an entry to define "maxpoll" to "10" as follows: server 0.rhel.pool.ntp.org iburst maxpoll 10 If NTP was running and "maxpoll" was updated, the NTP service must be restarted: # systemctl restart ntpd If NTP was not running, it must be started: # systemctl start ntpd If "chronyd" was running and "maxpoll" was updated, the service must be restarted: # systemctl restart chronyd.service If "chronyd" was not running, it must be started: # systemctl start chronyd.service

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72269" do title "The Red Hat Enterprise Linux operating system must, for networked systems, synchronize clocks with a server that is synchronized to one of the redundant United States Naval Observatory (USNO) time servers, a time server designated for the appropriate DoD network (NIPRNet/SIPRNet), and/or the Global Positioning System (GPS)." desc "Inaccurate time stamps make it more difficult to correlate events and can lead to an inaccurate analysis. Determining the correct time a particular event occurred on a system is critical when conducting forensic analysis and investigating system events. Sources outside the configured acceptable allowance (drift) may be inaccurate. Synchronizing internal information system clocks provides uniformity of time stamps for information systems with multiple system clocks and systems connected over a network. Organizations should consider endpoints that may not have regular access to the authoritative time server (e.g., mobile, teleworking, and tactical endpoints). " desc "rationale", "" desc "check", " Check to see if NTP is running in continuous mode: # ps -ef | grep ntp If NTP is not running, check to see if \"chronyd\" is running in continuous mode: # ps -ef | grep chronyd If NTP or \"chronyd\" is not running, this is a finding. If the NTP process is found, then check the \"ntp.conf\" file for the \"maxpoll\" option setting: # grep maxpoll /etc/ntp.conf server 0.rhel.pool.ntp.org iburst maxpoll 10 If the option is set to \"17\" or is not set, this is a finding. If the file does not exist, check the \"/etc/cron.daily\" subdirectory for a crontab file controlling the execution of the \"ntpd -q\" command. # grep -i \"ntpd -q\" /etc/cron.daily/* # ls -al /etc/cron.* | grep ntp ntp If a crontab file does not exist in the \"/etc/cron.daily\" that executes the \"ntpd -q\" command, this is a finding. If the \"chronyd\" process is found, then check the \"chrony.conf\" file for the \"maxpoll\" option setting: # grep maxpoll /etc/chrony.conf server 0.rhel.pool.ntp.org iburst maxpoll 10 If the option is not set or the line is commented out, this is a finding. " desc "fix", " Edit the \"/etc/ntp.conf\" or \"/etc/chrony.conf\" file and add or update an entry to define \"maxpoll\" to \"10\" as follows: server 0.rhel.pool.ntp.org iburst maxpoll 10 If NTP was running and \"maxpoll\" was updated, the NTP service must be restarted: # systemctl restart ntpd If NTP was not running, it must be started: # systemctl start ntpd If \"chronyd\" was running and \"maxpoll\" was updated, the service must be restarted: # systemctl restart chronyd.service If \"chronyd\" was not running, it must be started: # systemctl start chronyd.service " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000355-GPOS-00143" tag satisfies: ["SRG-OS-000355-GPOS-00143", "SRG-OS-000356-GPOS-00144"] tag gid: "V-72269" tag rid: "SV-86893r5_rule" tag stig_id: "RHEL-07-040500" tag fix_id: "F-78623r5_fix" tag cci: ["CCI-001891", "CCI-002046"] tag nist: ["AU-8 (1) (a)", "AU-8 (1) (b)", "Rev_4"] # Either ntpd or chronyd should be running describe.one do [service('ntpd'), service('chronyd')].each do |time_service| describe time_service do it { should be_running } it { should be_enabled } it { should be_installed } end end end if service('ntpd').installed? time_service = service('ntpd') time_sources = ntp_conf('/etc/ntp.conf').server max_poll_values = time_sources.map { |val| val.match?(/.*maxpoll.*/) ? val.gsub(/.*maxpoll\s+(\d+)(\s+.*|$)/,'\1').to_i : 99 } ntpdate_crons = command('grep -l "ntpd -q" /etc/cron.daily/*').stdout.strip.lines describe "ntpd time sources list" do subject { time_sources } it { should_not be_empty } end describe.one do # Case where maxpoll empty describe "Daily cron jobs for 'ntpd -q'" do subject { ntpdate_crons } it { should_not be_empty } end # All time sources must contain valid maxpoll entries describe "ntpd maxpoll values (99=maxpoll absent)" do subject { max_poll_values } it { should all be < 17 } end end end if service('chronyd').installed? time_service = service('chronyd') time_sources = ntp_conf('/etc/chrony.conf').server max_poll_values = time_sources.map { |val| val.match?(/.*maxpoll.*/) ? val.gsub(/.*maxpoll\s+(\d+)(\s+.*|$)/,'\1').to_i : 99 } describe "chronyd time sources list" do subject { time_sources } it { should_not be_empty } end # All time sources must contain valid maxpoll entries describe "chronyd maxpoll values (99=maxpoll absent)" do subject { max_poll_values } it { should all be < 17 } end end end
Any password, no matter how complex, can eventually be cracked. Therefore, passwords need to be changed periodically. If the operating system does not limit the lifetime of passwords and force users to change their passwords, there is the risk that the operating system passwords could be compromised.
Test Results

Status passed
Test /etc/shadow with user == "ec2-user" max_days.first.to_i is expected to cmp <= 60
Result
Result Details

Control V-71931
Title The Red Hat Enterprise Linux operating system must be configured so that existing passwords are restricted to a 60-day maximum lifetime.
Desc Any password, no matter how complex, can eventually be cracked. Therefore, passwords need to be changed periodically. If the operating system does not limit the lifetime of passwords and force users to change their passwords, there is the risk that the operating system passwords could be compromised.
Severity medium
Impact 0.5
Nist Controls IA-5 (1) (d), Rev_4
Check Text Check whether the maximum time period for existing passwords is restricted to 60 days. # awk -F: '$5 > 60 {print $1 " " $5}' /etc/shadow If any results are returned that are not associated with a system account, this is a finding.
Fix Text Configure non-compliant accounts to enforce a 60-day maximum password lifetime restriction. # chage -M 60 [user]

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71931" do title "The Red Hat Enterprise Linux operating system must be configured so that existing passwords are restricted to a 60-day maximum lifetime." desc "Any password, no matter how complex, can eventually be cracked. Therefore, passwords need to be changed periodically. If the operating system does not limit the lifetime of passwords and force users to change their passwords, there is the risk that the operating system passwords could be compromised." desc "rationale", "" desc "check", " Check whether the maximum time period for existing passwords is restricted to 60 days. # awk -F: '$5 > 60 {print $1 \" \" $5}' /etc/shadow If any results are returned that are not associated with a system account, this is a finding. " desc "fix", " Configure non-compliant accounts to enforce a 60-day maximum password lifetime restriction. # chage -M 60 [user] " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000076-GPOS-00044" tag gid: "V-71931" tag rid: "SV-86555r3_rule" tag stig_id: "RHEL-07-010260" tag fix_id: "F-78283r1_fix" tag cci: ["CCI-000199"] tag nist: ["IA-5 (1) (d)", "Rev_4"] shadow.users.each do |user| # filtering on non-system accounts (uid >= 1000) next unless user(user).uid >= 1000 describe shadow.users(user) do its('max_days.first.to_i') { should cmp <= 60 } end end end
The use of separate file systems for different paths can protect the system from failures resulting from a file system becoming full or failing.
Test Results

Status passed
Test Mount /var is expected to be mounted
Result Mount /var is not mounted
Result Details

Control V-72061
Title The Red Hat Enterprise Linux operating system must use a separate file system for /var.
Desc The use of separate file systems for different paths can protect the system from failures resulting from a file system becoming full or failing.
Severity low
Impact 0.3
Nist Controls CM-6 b, Rev_4
Check Text Verify that a separate file system/partition has been created for "/var". Check that a file system/partition has been created for "/var" with the following command: # grep /var /etc/fstab UUID=c274f65f /var ext4 noatime,nobarrier 1 2 If a separate entry for "/var" is not in use, this is a finding.
Fix Text Migrate the "/var" path onto a separate file system.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72061" do title "The Red Hat Enterprise Linux operating system must use a separate file system for /var." desc "The use of separate file systems for different paths can protect the system from failures resulting from a file system becoming full or failing." desc "rationale", "" desc "check", " Verify that a separate file system/partition has been created for \"/var\". Check that a file system/partition has been created for \"/var\" with the following command: # grep /var /etc/fstab UUID=c274f65f /var ext4 noatime,nobarrier 1 2 If a separate entry for \"/var\" is not in use, this is a finding. " desc "fix", "Migrate the \"/var\" path onto a separate file system." impact 0.3 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72061" tag rid: "SV-86685r2_rule" tag stig_id: "RHEL-07-021320" tag fix_id: "F-78413r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe mount('/var') do it { should be_mounted } end end
Adding host-based intrusion detection tools can provide the capability to automatically take actions in response to malicious behavior, which can provide additional agility in reacting to network threats. These tools also often include a reporting capability to provide network awareness of the system, which may not otherwise exist in an organization's systems management regime.
Test Results

Status passed
Test System Package MFEhiplsm is expected to be installed
Result expected that `System Package MFEhiplsm` is installed
Status passed
Test Processes /hipclient/ is expected to exist
Result expected Processes /hipclient/ to exist
Result Details

Control V-92255
Title The Red Hat Enterprise Linux operating system must have a host-based intrusion detection tool installed.
Desc Adding host-based intrusion detection tools can provide the capability to automatically take actions in response to malicious behavior, which can provide additional agility in reacting to network threats. These tools also often include a reporting capability to provide network awareness of the system, which may not otherwise exist in an organization's systems management regime.
Severity medium
Impact 0.5
Nist Controls SI-4 (5), Rev_4
Check Text Ask the SA or ISSO if a host-based intrusion detection application is loaded on the system. Per OPORD 16-0080, the preferred intrusion detection system is McAfee HBSS available through the U.S. Cyber Command (USCYBERCOM). If another host-based intrusion detection application is in use, such as SELinux, this must be documented and approved by the local Authorizing Official. Procedure: Examine the system to determine if the Host Intrusion Prevention System (HIPS) is installed: # rpm -qa | grep MFEhiplsm Verify that the McAfee HIPS module is active on the system: # ps -ef | grep -i “hipclient” If the MFEhiplsm package is not installed, check for another intrusion detection system: # find / -name <daemon name> Where <daemon name> is the name of the primary application daemon to determine if the application is loaded on the system. Determine if the application is active on the system: # ps -ef | grep -i <daemon name> If the MFEhiplsm package is not installed and an alternate host-based intrusion detection application has not been documented for use, this is a finding. If no host-based intrusion detection system is installed and running on the system, this is a finding.
Fix Text Install and enable the latest McAfee HIPS package, available from USCYBERCOM. Note: If the system does not support the McAfee HIPS package, install and enable a supported intrusion detection system application and document its use with the Authorizing Official.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-92255" do title "The Red Hat Enterprise Linux operating system must have a host-based intrusion detection tool installed." desc "Adding host-based intrusion detection tools can provide the capability to automatically take actions in response to malicious behavior, which can provide additional agility in reacting to network threats. These tools also often include a reporting capability to provide network awareness of the system, which may not otherwise exist in an organization's systems management regime." desc "rationale", "" desc "check", " Ask the SA or ISSO if a host-based intrusion detection application is loaded on the system. Per OPORD 16-0080, the preferred intrusion detection system is McAfee HBSS available through the U.S. Cyber Command (USCYBERCOM). If another host-based intrusion detection application is in use, such as SELinux, this must be documented and approved by the local Authorizing Official. Procedure: Examine the system to determine if the Host Intrusion Prevention System (HIPS) is installed: # rpm -qa | grep MFEhiplsm Verify that the McAfee HIPS module is active on the system: # ps -ef | grep -i “hipclient” If the MFEhiplsm package is not installed, check for another intrusion detection system: # find / -name <daemon name> Where <daemon name> is the name of the primary application daemon to determine if the application is loaded on the system. Determine if the application is active on the system: # ps -ef | grep -i <daemon name> If the MFEhiplsm package is not installed and an alternate host-based intrusion detection application has not been documented for use, this is a finding. If no host-based intrusion detection system is installed and running on the system, this is a finding. " desc "fix", " Install and enable the latest McAfee HIPS package, available from USCYBERCOM. Note: If the system does not support the McAfee HIPS package, install and enable a supported intrusion detection system application and document its use with the Authorizing Official. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000196" tag gid: "V-92255" tag rid: "SV-102357r1_rule" tag stig_id: "RHEL-07-020019" tag fix_id: "F-98477r1_fix" tag cci: ["CCI-001263"] tag nist: ["SI-4 (5)", "Rev_4"] custom_hips = input('custom_hips') if ! custom_hips describe package('MFEhiplsm') do it { should be_installed } end describe processes(/hipclient/) do it { should exist } end else # Special case for SELinux sel_mode = command('getenforce').stdout.strip custom_hips_daemon = input('custom_hips_daemon') max_daemon_processes = input('max_daemon_processes') describe.one do describe "SELinux mode" do subject { sel_mode } it { should cmp 'Enforcing' } end describe processes(/#{custom_hips_daemon}/) do it { should exist } its('count') { should be < max_daemon_processes } end end end end
A session time-out lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not log out because of the temporary nature of the absence. Rather than relying on the user to manually lock their operating system session prior to vacating the vicinity, operating systems need to be able to identify when a user's session has idled and take action to initiate the session lock. The session lock is implemented at the point where session activity can be determined and/or controlled.
Test Results

Status skipped
Test The system does not have GNOME installed
Result
Result Details

Control V-71893
Title The Red Hat Enterprise Linux operating system must initiate a screensaver after a 15-minute period of inactivity for graphical user interfaces.
Desc A session time-out lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not log out because of the temporary nature of the absence. Rather than relying on the user to manually lock their operating system session prior to vacating the vicinity, operating systems need to be able to identify when a user's session has idled and take action to initiate the session lock. The session lock is implemented at the point where session activity can be determined and/or controlled.
Severity none
Nist Controls AC-11 a, Rev_4
Check Text Verify the operating system initiates a screensaver after a 15-minute period of inactivity for graphical user interfaces. The screen program must be installed to lock sessions on the console. Note: If the system does not have GNOME installed, this requirement is Not Applicable. Check to see if GNOME is configured to display a screensaver after a 15 minute delay with the following command: # grep -i idle-delay /etc/dconf/db/local.d/* idle-delay=uint32 900 If the "idle-delay" setting is missing or is not set to "900" or less, this is a finding.
Fix Text Configure the operating system to initiate a screensaver after a 15-minute period of inactivity for graphical user interfaces. Create a database to contain the system-wide screensaver settings (if it does not already exist) with the following command: # touch /etc/dconf/db/local.d/00-screensaver Edit /etc/dconf/db/local.d/00-screensaver and add or update the following lines: [org/gnome/desktop/session] # Set the lock time out to 900 seconds before the session is considered idle idle-delay=uint32 900 You must include the "uint32" along with the integer key values as shown. Update the system databases: # dconf update Users must log out and back in again before the system-wide settings take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71893" do title "The Red Hat Enterprise Linux operating system must initiate a screensaver after a 15-minute period of inactivity for graphical user interfaces." desc "A session time-out lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not log out because of the temporary nature of the absence. Rather than relying on the user to manually lock their operating system session prior to vacating the vicinity, operating systems need to be able to identify when a user's session has idled and take action to initiate the session lock. The session lock is implemented at the point where session activity can be determined and/or controlled. " desc "rationale", "" desc "check", " Verify the operating system initiates a screensaver after a 15-minute period of inactivity for graphical user interfaces. The screen program must be installed to lock sessions on the console. Note: If the system does not have GNOME installed, this requirement is Not Applicable. Check to see if GNOME is configured to display a screensaver after a 15 minute delay with the following command: # grep -i idle-delay /etc/dconf/db/local.d/* idle-delay=uint32 900 If the \"idle-delay\" setting is missing or is not set to \"900\" or less, this is a finding. " desc "fix", " Configure the operating system to initiate a screensaver after a 15-minute period of inactivity for graphical user interfaces. Create a database to contain the system-wide screensaver settings (if it does not already exist) with the following command: # touch /etc/dconf/db/local.d/00-screensaver Edit /etc/dconf/db/local.d/00-screensaver and add or update the following lines: [org/gnome/desktop/session] # Set the lock time out to 900 seconds before the session is considered idle idle-delay=uint32 900 You must include the \"uint32\" along with the integer key values as shown. Update the system databases: # dconf update Users must log out and back in again before the system-wide settings take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000029-GPOS-00010" tag gid: "V-71893" tag rid: "SV-86517r5_rule" tag stig_id: "RHEL-07-010070" tag fix_id: "F-78245r5_fix" tag cci: ["CCI-000057"] tag nist: ["AC-11 a", "Rev_4"] unless package('gnome-desktop3').installed? impact 0.0 describe "The system does not have GNOME installed" do skip "The system does not have GNOME installed, this requirement is Not Applicable." end else describe command("gsettings get org.gnome.desktop.session idle-delay | cut -d ' ' -f2") do its('stdout.strip') { should cmp <= 900 } end end end
Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised.
Test Results

Status passed
Test Parse Config File /etc/security/pwquality.conf maxrepeat.to_i is expected to cmp <= 3
Result
Result Details

Control V-71915
Title The Red Hat Enterprise Linux operating system must be configured so that when passwords are changed the number of repeating consecutive characters must not be more than three characters.
Desc Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised.
Severity medium
Impact 0.5
Nist Controls IA-5 (1) (b), Rev_4
Check Text The "maxrepeat" option sets the maximum number of allowed same consecutive characters in a new password. Check for the value of the "maxrepeat" option in "/etc/security/pwquality.conf" with the following command: # grep maxrepeat /etc/security/pwquality.conf maxrepeat = 3 If the value of "maxrepeat" is set to more than "3", this is a finding.
Fix Text Configure the operating system to require the change of the number of repeating consecutive characters when passwords are changed by setting the "maxrepeat" option. Add the following line to "/etc/security/pwquality.conf conf" (or modify the line to have the required value): maxrepeat = 3

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71915" do title "The Red Hat Enterprise Linux operating system must be configured so that when passwords are changed the number of repeating consecutive characters must not be more than three characters." desc "Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised. " desc "rationale", "" desc "check", " The \"maxrepeat\" option sets the maximum number of allowed same consecutive characters in a new password. Check for the value of the \"maxrepeat\" option in \"/etc/security/pwquality.conf\" with the following command: # grep maxrepeat /etc/security/pwquality.conf maxrepeat = 3 If the value of \"maxrepeat\" is set to more than \"3\", this is a finding. " desc "fix", " Configure the operating system to require the change of the number of repeating consecutive characters when passwords are changed by setting the \"maxrepeat\" option. Add the following line to \"/etc/security/pwquality.conf conf\" (or modify the line to have the required value): maxrepeat = 3 " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000072-GPOS-00040" tag gid: "V-71915" tag rid: "SV-86539r3_rule" tag stig_id: "RHEL-07-010180" tag fix_id: "F-78267r2_fix" tag cci: ["CCI-000195"] tag nist: ["IA-5 (1) (b)", "Rev_4"] describe parse_config_file("/etc/security/pwquality.conf") do its('maxrepeat.to_i') { should cmp <= 3 } end end
The "noexec" mount option causes the system to not execute binary files. This option must be used for mounting any file system not containing approved binary files as they may be incompatible. Executing files from untrusted file systems increases the opportunity for unprivileged users to attain unauthorized administrative access.
Test Results

Status passed
Test Mount /dev/shm options is expected to include "noexec"
Result expected ["rw", "nosuid", "nodev", "seclabel"] to include "noexec"
Result Details

Control V-81013
Title The Red Hat Enterprise Linux operating system must mount /dev/shm with the noexec option.
Desc The "noexec" mount option causes the system to not execute binary files. This option must be used for mounting any file system not containing approved binary files as they may be incompatible. Executing files from untrusted file systems increases the opportunity for unprivileged users to attain unauthorized administrative access.
Severity low
Impact 0.3
Nist Controls CM-7 (2), Rev_4
Check Text Verify that the "noexec" option is configured for /dev/shm: # cat /etc/fstab | grep /dev/shm tmpfs /dev/shm tmpfs defaults,nodev,nosuid,noexec 0 0 If any results are returned and the "noexec" option is not listed, this is a finding. Verify "/dev/shm" is mounted with the "noexec" option: # mount | grep "/dev/shm" | grep noexec If no results are returned, this is a finding.
Fix Text Configure the system so that /dev/shm is mounted with the "noexec" option.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-81013" do title "The Red Hat Enterprise Linux operating system must mount /dev/shm with the noexec option." desc "The \"noexec\" mount option causes the system to not execute binary files. This option must be used for mounting any file system not containing approved binary files as they may be incompatible. Executing files from untrusted file systems increases the opportunity for unprivileged users to attain unauthorized administrative access." desc "rationale", "" desc "check", " Verify that the \"noexec\" option is configured for /dev/shm: # cat /etc/fstab | grep /dev/shm tmpfs /dev/shm tmpfs defaults,nodev,nosuid,noexec 0 0 If any results are returned and the \"noexec\" option is not listed, this is a finding. Verify \"/dev/shm\" is mounted with the \"noexec\" option: # mount | grep \"/dev/shm\" | grep noexec If no results are returned, this is a finding. " desc "fix", "Configure the system so that /dev/shm is mounted with the \"noexec\" option." impact 0.3 tag severity: nil tag gtitle: "SRG-OS-000368-GPOS-00154" tag gid: "V-81013" tag rid: "SV-95725r2_rule" tag stig_id: "RHEL-07-021024" tag fix_id: "F-87847r2_fix" tag cci: ["CCI-001764"] tag nist: ["CM-7 (2)", "Rev_4"] describe mount('/dev/shm') do its('options') { should include 'noexec' } end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with file == "/etc/security/opasswd" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/etc/security/opasswd" action is expected not to include "never"
Result
Status passed
Test ["w", "a"] is expected to include "w"
Result
Status passed
Test ["w", "a"] is expected to include "a"
Result
Result Details

Control V-73173
Title The Red Hat Enterprise Linux operating system must generate audit records for all account creations, modifications, disabling, and termination events that affect /etc/opasswd.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AC-2 (4), AU-12 c, AC-2 (4), AC-2 (4), Rev_4
Check Text Verify the operating system must generate audit records for all account creations, modifications, disabling, and termination events that affect /etc/opasswd. Check the auditing rules in "/etc/audit/audit.rules" with the following command: # grep /etc/security/opasswd /etc/audit/audit.rules -w /etc/security/opasswd -p wa -k identity If the command does not return a line, or the line is commented out, this is a finding.
Fix Text Configure the operating system to generate audit records for all account creations, modifications, disabling, and termination events that affect /etc/opasswd. Add or update the following file system rule in "/etc/audit/rules.d/audit.rules": -w /etc/security/opasswd -p wa -k identity The audit daemon must be restarted for the changes to take effect: # systemctl restart auditd

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-73173" do title "The Red Hat Enterprise Linux operating system must generate audit records for all account creations, modifications, disabling, and termination events that affect /etc/opasswd." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system must generate audit records for all account creations, modifications, disabling, and termination events that affect /etc/opasswd. Check the auditing rules in \"/etc/audit/audit.rules\" with the following command: # grep /etc/security/opasswd /etc/audit/audit.rules -w /etc/security/opasswd -p wa -k identity If the command does not return a line, or the line is commented out, this is a finding. " desc "fix", " Configure the operating system to generate audit records for all account creations, modifications, disabling, and termination events that affect /etc/opasswd. Add or update the following file system rule in \"/etc/audit/rules.d/audit.rules\": -w /etc/security/opasswd -p wa -k identity The audit daemon must be restarted for the changes to take effect: # systemctl restart auditd " tag severity: nil tag gtitle: "SRG-OS-000004-GPOS-00004" tag gid: "V-73173" tag rid: "SV-87825r5_rule" tag stig_id: "RHEL-07-030874" tag fix_id: "F-79619r6_fix" tag cci: ["CCI-000018", "CCI-000172", "CCI-001403", "CCI-002130"] tag nist: ["AC-2 (4)", "AU-12 c", "AC-2 (4)", "AC-2 (4)", "Rev_4"] audit_file = '/etc/security/opasswd' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'w' } it { should include 'a' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with syscall == "removexattr" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "removexattr" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "removexattr" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "removexattr" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Result Details

Control V-72117
Title The Red Hat Enterprise Linux operating system must audit all uses of the removexattr syscall.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-12 c, Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "removexattr" syscall occur. Check the file system rules in "/etc/audit/audit.rules" with the following commands: # grep -iw removexattr /etc/audit/audit.rules -a always,exit -F arch=b32 -S removexattr -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S removexattr -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the "b32" and "b64" audit rules are not defined for the "removexattr" syscall, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "removexattr" syscall occur. Add or update the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S removexattr -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S removexattr -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72117" do title "The Red Hat Enterprise Linux operating system must audit all uses of the removexattr syscall." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"removexattr\" syscall occur. Check the file system rules in \"/etc/audit/audit.rules\" with the following commands: # grep -iw removexattr /etc/audit/audit.rules -a always,exit -F arch=b32 -S removexattr -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S removexattr -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the \"b32\" and \"b64\" audit rules are not defined for the \"removexattr\" syscall, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"removexattr\" syscall occur. Add or update the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S removexattr -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S removexattr -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000458-GPOS-00203" tag satisfies: ["SRG-OS-000458-GPOS-00203", "SRG-OS-000392-GPOS-00172", "SRG-OS-000064-GPOS-00033"] tag gid: "V-72117" tag rid: "SV-86741r5_rule" tag stig_id: "RHEL-07-030470" tag fix_id: "F-78469r7_fix" tag cci: ["CCI-000172"] tag nist: ["AU-12 c", "Rev_4"] describe auditd.syscall("removexattr").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end if os.arch == 'x86_64' describe auditd.syscall("removexattr").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end end end
Configuring the operating system to implement organization-wide security implementation guides and security checklists verifies compliance with federal standards and establishes a common security baseline across DoD that reflects the most restrictive security posture consistent with operational requirements. Configuration settings are the set of parameters that can be changed in hardware, software, or firmware components of the system that affect the security posture and/or functionality of the system. Security-related parameters are those parameters impacting the security state of the system, including the parameters required to satisfy other security control requirements. Security-related parameters include, for example, registry settings; account, file, and directory permission settings; and settings for functions, ports, protocols, services, and remote connections.
Test Results

Status passed
Test login.defs FAIL_DELAY.to_i is expected to cmp >= 4
Result
Result Details

Control V-71951
Title The Red Hat Enterprise Linux operating system must be configured so that the delay between logon prompts following a failed console logon attempt is at least four seconds.
Desc Configuring the operating system to implement organization-wide security implementation guides and security checklists verifies compliance with federal standards and establishes a common security baseline across DoD that reflects the most restrictive security posture consistent with operational requirements. Configuration settings are the set of parameters that can be changed in hardware, software, or firmware components of the system that affect the security posture and/or functionality of the system. Security-related parameters are those parameters impacting the security state of the system, including the parameters required to satisfy other security control requirements. Security-related parameters include, for example, registry settings; account, file, and directory permission settings; and settings for functions, ports, protocols, services, and remote connections.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the operating system enforces a delay of at least four seconds between console logon prompts following a failed logon attempt. Check the value of the "fail_delay" parameter in the "/etc/login.defs" file with the following command: # grep -i fail_delay /etc/login.defs FAIL_DELAY 4 If the value of "FAIL_DELAY" is not set to "4" or greater, or the line is commented out, this is a finding.
Fix Text Configure the operating system to enforce a delay of at least four seconds between logon prompts following a failed console logon attempt. Modify the "/etc/login.defs" file to set the "FAIL_DELAY" parameter to "4" or greater: FAIL_DELAY 4

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71951" do title "The Red Hat Enterprise Linux operating system must be configured so that the delay between logon prompts following a failed console logon attempt is at least four seconds." desc "Configuring the operating system to implement organization-wide security implementation guides and security checklists verifies compliance with federal standards and establishes a common security baseline across DoD that reflects the most restrictive security posture consistent with operational requirements. Configuration settings are the set of parameters that can be changed in hardware, software, or firmware components of the system that affect the security posture and/or functionality of the system. Security-related parameters are those parameters impacting the security state of the system, including the parameters required to satisfy other security control requirements. Security-related parameters include, for example, registry settings; account, file, and directory permission settings; and settings for functions, ports, protocols, services, and remote connections. " desc "rationale", "" desc "check", " Verify the operating system enforces a delay of at least four seconds between console logon prompts following a failed logon attempt. Check the value of the \"fail_delay\" parameter in the \"/etc/login.defs\" file with the following command: # grep -i fail_delay /etc/login.defs FAIL_DELAY 4 If the value of \"FAIL_DELAY\" is not set to \"4\" or greater, or the line is commented out, this is a finding. " desc "fix", " Configure the operating system to enforce a delay of at least four seconds between logon prompts following a failed console logon attempt. Modify the \"/etc/login.defs\" file to set the \"FAIL_DELAY\" parameter to \"4\" or greater: FAIL_DELAY 4 " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00226" tag gid: "V-71951" tag rid: "SV-86575r2_rule" tag stig_id: "RHEL-07-010430" tag fix_id: "F-78303r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe login_defs do its('FAIL_DELAY.to_i') { should cmp >= 4 } end end
This control consistently takes a long to run and has been disabled using the disable_slow_controls attribute.
Test Results

Status skipped
Test This control consistently takes a long to run and has been disabled using the disable_slow_controls attribute.
Result
Result Details

Control V-72037
Title The Red Hat Enterprise Linux operating system must be configured so that local initialization files do not execute world-writable programs.
Desc This control consistently takes a long to run and has been disabled using the disable_slow_controls attribute.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify that local initialization files do not execute world-writable programs. Check the system for world-writable files with the following command: # find / -xdev -perm -002 -type f -exec ls -ld {} \; | more For all files listed, check for their presence in the local initialization files with the following commands: Note: The example will be for a system that is configured to create users' home directories in the "/home" directory. # grep <file> /home/*/.* If any local initialization files are found to reference world-writable files, this is a finding.
Fix Text Set the mode on files being executed by the local initialization files with the following command: # chmod 0755 <file>

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72037" do title "The Red Hat Enterprise Linux operating system must be configured so that local initialization files do not execute world-writable programs." if input('disable_slow_controls') desc "This control consistently takes a long to run and has been disabled using the disable_slow_controls attribute." else desc "If user start-up files execute world-writable programs, especially in unprotected directories, they could be maliciously modified to destroy user files or otherwise compromise the system at the user level. If the system is compromised at the user level, it is easier to elevate privileges to eventually compromise the system at the root and network level." end desc "rationale", "" desc "check", " Verify that local initialization files do not execute world-writable programs. Check the system for world-writable files with the following command: # find / -xdev -perm -002 -type f -exec ls -ld {} \\; | more For all files listed, check for their presence in the local initialization files with the following commands: Note: The example will be for a system that is configured to create users' home directories in the \"/home\" directory. # grep <file> /home/*/.* If any local initialization files are found to reference world-writable files, this is a finding. " desc "fix", " Set the mode on files being executed by the local initialization files with the following command: # chmod 0755 <file> " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72037" tag rid: "SV-86661r2_rule" tag stig_id: "RHEL-07-020730" tag fix_id: "F-78389r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] exempt_home_users = input('exempt_home_users') non_interactive_shells = input('non_interactive_shells') if input('disable_slow_controls') describe "This control consistently takes a long to run and has been disabled using the disable_slow_controls attribute." do skip "This control consistently takes a long to run and has been disabled using the disable_slow_controls attribute. You must enable this control for a full accredidation for production." end else ignore_shells = non_interactive_shells.join('|') #Get home directory for users with UID >= 1000 or UID == 0 and support interactive logins. dotfiles = Set[] u = users.where{ !shell.match(ignore_shells) && (uid >= 1000 || uid == 0)}.entries #For each user, build and execute a find command that identifies initialization files #in a user's home directory. u.each do |user| dotfiles = dotfiles + command("find #{user.home} -xdev -maxdepth 2 ( -name '.*' ! -name '.bash_history' ) -type f").stdout.split("\n") end ww_files = Set[] ww_files = command('find / -xdev -perm -002 -type f -exec ls {} \;').stdout.lines #To reduce the number of commands ran, we use a pattern file in the grep command below #So we don't have too long of a grep command, we chunk the list of ww_files #into strings not longer than PATTERN_FILE_MAX_LENGTH #Based on MAX_ARG_STRLEN, /usr/include/linux/binfmts.h #We cut off 100 to leave room for the rest of the arguments PATTERN_FILE_MAX_LENGTH=command("getconf PAGE_SIZE").stdout.to_i * 32 - 100 ww_chunked=[""] ww_files.each do |item| item = item.strip if item.length + "\n".length > PATTERN_FILE_MAX_LENGTH raise "Single pattern is longer than PATTERN_FILE_MAX_LENGTH" end if ww_chunked[-1].length + "\n".length + item.length > PATTERN_FILE_MAX_LENGTH ww_chunked.append("") end ww_chunked[-1] += "\n" + item # This will leave an extra newline at the beginning of chunks end ww_chunked = ww_chunked.map(&:strip) # This gets rid of the beginning newlines if ww_chunked[0] == "" ww_chunked = [] # If we didn't have any ww_files, this will prevent an empty grep pattern end #Check each dotfile for existence of each world-writeable file findings = Set[] dotfiles.each do |dotfile| dotfile = dotfile.strip ww_chunked.each do |ww_pattern_file| count = command("grep -c -f <(echo \"#{ww_pattern_file}\") \"#{dotfile}\"").stdout.strip.to_i findings << dotfile if count > 0 end end describe "Local initialization files that are found to reference world-writable files" do subject { findings.to_a } it { should be_empty } end end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with syscall == "lremovexattr" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "lremovexattr" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "lremovexattr" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "lremovexattr" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Result Details

Control V-72121
Title The Red Hat Enterprise Linux operating system must audit all uses of the lremovexattr syscall.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-12 c, Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "lremovexattr" syscall occur. Check the file system rules in "/etc/audit/audit.rules" with the following commands: # grep -iw lremovexattr /etc/audit/audit.rules -a always,exit -F arch=b32 -S lremovexattr -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S lremovexattr -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the "b32" and "b64" audit rules are not defined for the "lremovexattr" syscall, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "lremovexattr" syscall occur. Add or update the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S lremovexattr -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S lremovexattr -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72121" do title "The Red Hat Enterprise Linux operating system must audit all uses of the lremovexattr syscall." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"lremovexattr\" syscall occur. Check the file system rules in \"/etc/audit/audit.rules\" with the following commands: # grep -iw lremovexattr /etc/audit/audit.rules -a always,exit -F arch=b32 -S lremovexattr -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S lremovexattr -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the \"b32\" and \"b64\" audit rules are not defined for the \"lremovexattr\" syscall, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"lremovexattr\" syscall occur. Add or update the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S lremovexattr -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S lremovexattr -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000458-GPOS-00203" tag satisfies: ["SRG-OS-000458-GPOS-00203", "SRG-OS-000392-GPOS-00172", "SRG-OS-000064-GPOS-00033"] tag gid: "V-72121" tag rid: "SV-86745r5_rule" tag stig_id: "RHEL-07-030490" tag fix_id: "F-78473r7_fix" tag cci: ["CCI-000172"] tag nist: ["AU-12 c", "Rev_4"] describe auditd.syscall("lremovexattr").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end if os.arch == 'x86_64' describe auditd.syscall("lremovexattr").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end end end
If an account other than root also has a User Identifier (UID) of "0", it has root authority, giving that account unrestricted access to the entire operating system. Multiple accounts with a UID of "0" afford an opportunity for potential intruders to guess a password for a privileged account.
Test Results

Status passed
Test /etc/passwd with uid == 0 users is expected to cmp == "root"
Result
Status passed
Test /etc/passwd with uid == 0 entries.length is expected to eq 1
Result
Result Details

Control V-72005
Title The Red Hat Enterprise Linux operating system must be configured so that the root account must be the only account having unrestricted access to the system.
Desc If an account other than root also has a User Identifier (UID) of "0", it has root authority, giving that account unrestricted access to the entire operating system. Multiple accounts with a UID of "0" afford an opportunity for potential intruders to guess a password for a privileged account.
Severity high
Impact 0.7
Nist Controls CM-6 b, Rev_4
Check Text Check the system for duplicate UID "0" assignments with the following command: # awk -F: '$3 == 0 {print $1}' /etc/passwd If any accounts other than root have a UID of "0", this is a finding.
Fix Text Change the UID of any account on the system, other than root, that has a UID of "0". If the account is associated with system commands or applications, the UID should be changed to one greater than "0" but less than "1000". Otherwise, assign a UID of greater than "1000" that has not already been assigned.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72005" do title "The Red Hat Enterprise Linux operating system must be configured so that the root account must be the only account having unrestricted access to the system." desc "If an account other than root also has a User Identifier (UID) of \"0\", it has root authority, giving that account unrestricted access to the entire operating system. Multiple accounts with a UID of \"0\" afford an opportunity for potential intruders to guess a password for a privileged account." desc "rationale", "" desc "check", " Check the system for duplicate UID \"0\" assignments with the following command: # awk -F: '$3 == 0 {print $1}' /etc/passwd If any accounts other than root have a UID of \"0\", this is a finding. " desc "fix", " Change the UID of any account on the system, other than root, that has a UID of \"0\". If the account is associated with system commands or applications, the UID should be changed to one greater than \"0\" but less than \"1000\". Otherwise, assign a UID of greater than \"1000\" that has not already been assigned. " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72005" tag rid: "SV-86629r2_rule" tag stig_id: "RHEL-07-020310" tag fix_id: "F-78357r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe passwd.uids(0) do its('users') { should cmp 'root' } its('entries.length') { should eq 1 } end end
DoD information systems are required to use FIPS 140-2 approved cryptographic hash functions. The only SSHv2 hash algorithm meeting this requirement is SHA.
Test Results

Status passed
Test hmac-sha2-256 is expected to be in "hmac-sha2-256" and "hmac-sha2-512"
Result
Status passed
Test hmac-sha2-512 is expected to be in "hmac-sha2-256" and "hmac-sha2-512"
Result
Result Details

Control V-72253
Title The Red Hat Enterprise Linux operating system must be configured so that the SSH daemon is configured to only use Message Authentication Codes (MACs) employing FIPS 140-2 approved cryptographic hash algorithms.
Desc DoD information systems are required to use FIPS 140-2 approved cryptographic hash functions. The only SSHv2 hash algorithm meeting this requirement is SHA.
Severity medium
Impact 0.5
Nist Controls AC-17 (2), Rev_4
Check Text Verify the SSH daemon is configured to only use MACs employing FIPS 140-2-approved ciphers. Note: If RHEL-07-021350 is a finding, this is automatically a finding as the system cannot implement FIPS 140-2-approved cryptographic algorithms and hashes. Check that the SSH daemon is configured to only use MACs employing FIPS 140-2-approved ciphers with the following command: # grep -i macs /etc/ssh/sshd_config MACs hmac-sha2-256,hmac-sha2-512 If any ciphers other than "hmac-sha2-256" or "hmac-sha2-512" are listed or the returned line is commented out, this is a finding.
Fix Text Edit the "/etc/ssh/sshd_config" file to uncomment or add the line for the "MACs" keyword and set its value to "hmac-sha2-256" and/or "hmac-sha2-512" (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor): MACs hmac-sha2-256,hmac-sha2-512 The SSH service must be restarted for changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72253" do title "The Red Hat Enterprise Linux operating system must be configured so that the SSH daemon is configured to only use Message Authentication Codes (MACs) employing FIPS 140-2 approved cryptographic hash algorithms." desc "DoD information systems are required to use FIPS 140-2 approved cryptographic hash functions. The only SSHv2 hash algorithm meeting this requirement is SHA." desc "rationale", "" desc "check", " Verify the SSH daemon is configured to only use MACs employing FIPS 140-2-approved ciphers. Note: If RHEL-07-021350 is a finding, this is automatically a finding as the system cannot implement FIPS 140-2-approved cryptographic algorithms and hashes. Check that the SSH daemon is configured to only use MACs employing FIPS 140-2-approved ciphers with the following command: # grep -i macs /etc/ssh/sshd_config MACs hmac-sha2-256,hmac-sha2-512 If any ciphers other than \"hmac-sha2-256\" or \"hmac-sha2-512\" are listed or the returned line is commented out, this is a finding. " desc "fix", " Edit the \"/etc/ssh/sshd_config\" file to uncomment or add the line for the \"MACs\" keyword and set its value to \"hmac-sha2-256\" and/or \"hmac-sha2-512\" (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor): MACs hmac-sha2-256,hmac-sha2-512 The SSH service must be restarted for changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000250-GPOS-00093" tag gid: "V-72253" tag rid: "SV-86877r3_rule" tag stig_id: "RHEL-07-040400" tag fix_id: "F-78607r2_fix" tag cci: ["CCI-001453"] tag nist: ["AC-17 (2)", "Rev_4"] @macs = inspec.sshd_config.params("macs") if @macs.nil? # fail fast describe 'The `sshd_config` setting for `MACs`' do subject { @macs } it 'should be explicitly set and not commented out' do expect(subject).not_to be_nil end end else @macs.first.split(",").each do |mac| describe mac do it { should be_in ['hmac-sha2-256', 'hmac-sha2-512'] } end end end end
The umask controls the default access mode assigned to newly created files. A umask of 077 limits new files to mode 700 or less permissive. Although umask can be represented as a four-digit number, the first digit representing special access modes is typically ignored or required to be "0". This requirement applies to the globally configured system defaults and the local interactive user defaults for each account on the system.
Test Results

Status passed
Test No interactive user initialization files with a less restrictive umask were found. is expected to eq true
Result
Status passed
Test No users were found with a less restrictive umask were found. is expected to eq true
Result
Result Details

Control V-72049
Title The Red Hat Enterprise Linux operating system must set the umask value to 077 for all local interactive user accounts.
Desc The umask controls the default access mode assigned to newly created files. A umask of 077 limits new files to mode 700 or less permissive. Although umask can be represented as a four-digit number, the first digit representing special access modes is typically ignored or required to be "0". This requirement applies to the globally configured system defaults and the local interactive user defaults for each account on the system.
Severity medium
Impact 0.5
Nist Controls CM-3 f, CM-6 c, CM-11 (2), CM-5 (1), CM-5 (1), Rev_4
Check Text Verify that the default umask for all local interactive users is "077". Identify the locations of all local interactive user home directories by looking at the "/etc/passwd" file. Check all local interactive user initialization files for interactive users with the following command: Note: The example is for a system that is configured to create users home directories in the "/home" directory. # grep -i umask /home/*/.* If any local interactive user initialization files are found to have a umask statement that has a value less restrictive than "077", this is a finding.
Fix Text Remove the umask statement from all local interactive user's initialization files. If the account is for an application, the requirement for a umask less restrictive than "077" can be documented with the Information System Security Officer, but the user agreement for access to the account must specify that the local interactive user must log on to their account first and then switch the user to the application account with the correct option to gain the account's environment variables.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72049" do title "The Red Hat Enterprise Linux operating system must set the umask value to 077 for all local interactive user accounts." desc "The umask controls the default access mode assigned to newly created files. A umask of 077 limits new files to mode 700 or less permissive. Although umask can be represented as a four-digit number, the first digit representing special access modes is typically ignored or required to be \"0\". This requirement applies to the globally configured system defaults and the local interactive user defaults for each account on the system." desc "rationale", "" desc "check", " Verify that the default umask for all local interactive users is \"077\". Identify the locations of all local interactive user home directories by looking at the \"/etc/passwd\" file. Check all local interactive user initialization files for interactive users with the following command: Note: The example is for a system that is configured to create users home directories in the \"/home\" directory. # grep -i umask /home/*/.* If any local interactive user initialization files are found to have a umask statement that has a value less restrictive than \"077\", this is a finding. " desc "fix", " Remove the umask statement from all local interactive user's initialization files. If the account is for an application, the requirement for a umask less restrictive than \"077\" can be documented with the Information System Security Officer, but the user agreement for access to the account must specify that the local interactive user must log on to their account first and then switch the user to the application account with the correct option to gain the account's environment variables. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72049" tag rid: "SV-86673r2_rule" tag stig_id: "RHEL-07-021040" tag fix_id: "F-78401r3_fix" tag cci: ["CCI-000318", "CCI-000368", "CCI-001812", "CCI-001813", "CCI-001814"] tag nist: ["CM-3 f", "CM-6 c", "CM-11 (2)", "CM-5 (1)", "CM-5 (1)", "Rev_4"] non_interactive_shells = input('non_interactive_shells') # Get all interactive users ignore_shells = non_interactive_shells.join('|') # Get home directory for users with UID >= 1000 or UID == 0 and support interactive logins. findings = Set[] dotfiles = Set[] umasks = {} umask_findings = Set[] # Get UID_MIN from login.defs uid_min = 1000 if file("/etc/login.defs").exist? uid_min_val = command("grep '^UID_MIN' /etc/login.defs | grep -Po '[0-9]+'").stdout.split("\n") if !uid_min_val.empty? uid_min = uid_min_val[0].to_i end end interactive_users = users.where{ !shell.match(ignore_shells) && (uid >= uid_min || uid == 0)}.entries # For each user, build and execute a find command that identifies initialization files # in a user's home directory. interactive_users.each do |u| # Only check if the home directory is local is_local = command("df -l #{u.home}").exit_status if is_local == 0 # Get user's initialization files dotfiles = dotfiles + command("find #{u.home} -xdev -maxdepth 2 ( -name '.*' ! -name '.bash_history' ) -type f").stdout.split("\n") # Get user's umask umasks.store(u.username,command("su -c 'umask' -l #{u.username}").stdout.chomp("\n")) # Check all local initialization files to see whether or not they are less restrictive than 077. dotfiles.each do |df| if file(df).more_permissive_than?("0077") findings = findings + df end end # Check umask for all interactive users umasks.each do |key,value| max_mode = ("0077").to_i(8) inv_mode = 0777 ^ max_mode if inv_mode & (value).to_i(8) != 0 umask_findings = umask_findings + key end end else describe "This control skips non-local filesystems" do skip "This control has skipped the #{u.home} home directory for #{u.username} because it is not a local filesystem." end end end # Report on any interactive files that are less restrictive than 077. describe "No interactive user initialization files with a less restrictive umask were found." do subject { findings.empty? } it { should eq true } end # Report on any interactive users that have a umask less restrictive than 077. describe "No users were found with a less restrictive umask were found." do subject { umask_findings.empty? } it { should eq true } end end
Routing protocol daemons are typically used on routers to exchange network topology information with other routers. If this software is used when not required, system network information may be unnecessarily transmitted across the network.
Test Results

Status passed
Test Kernel Parameter net.ipv4.ip_forward value is expected to eq 0
Result
Result Details

Control V-72309
Title The Red Hat Enterprise Linux operating system must not be performing packet forwarding unless the system is a router.
Desc Routing protocol daemons are typically used on routers to exchange network topology information with other routers. If this software is used when not required, system network information may be unnecessarily transmitted across the network.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the system is not performing packet forwarding, unless the system is a router. # grep net.ipv4.ip_forward /etc/sysctl.conf /etc/sysctl.d/* net.ipv4.ip_forward = 0 If "net.ipv4.ip_forward" is not configured in the /etc/sysctl.conf file or in the /etc/sysctl.d/ directory, is commented out, or does not have a value of "0", this is a finding. Check that the operating system does not implement IP forwarding using the following command: # /sbin/sysctl -a | grep net.ipv4.ip_forward net.ipv4.ip_forward = 0 If IP forwarding value is "1" and the system is hosting any application, database, or web servers, this is a finding.
Fix Text Set the system to the required kernel parameter by adding the following line to "/etc/sysctl.conf" or a configuration file in the /etc/sysctl.d/ directory (or modify the line to have the required value): net.ipv4.ip_forward = 0 Issue the following command to make the changes take effect: # sysctl --system

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72309" do title "The Red Hat Enterprise Linux operating system must not be performing packet forwarding unless the system is a router." desc "Routing protocol daemons are typically used on routers to exchange network topology information with other routers. If this software is used when not required, system network information may be unnecessarily transmitted across the network." desc "rationale", "" desc "check", " Verify the system is not performing packet forwarding, unless the system is a router. # grep net.ipv4.ip_forward /etc/sysctl.conf /etc/sysctl.d/* net.ipv4.ip_forward = 0 If \"net.ipv4.ip_forward\" is not configured in the /etc/sysctl.conf file or in the /etc/sysctl.d/ directory, is commented out, or does not have a value of \"0\", this is a finding. Check that the operating system does not implement IP forwarding using the following command: # /sbin/sysctl -a | grep net.ipv4.ip_forward net.ipv4.ip_forward = 0 If IP forwarding value is \"1\" and the system is hosting any application, database, or web servers, this is a finding. " desc "fix", " Set the system to the required kernel parameter by adding the following line to \"/etc/sysctl.conf\" or a configuration file in the /etc/sysctl.d/ directory (or modify the line to have the required value): net.ipv4.ip_forward = 0 Issue the following command to make the changes take effect: # sysctl --system " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72309" tag rid: "SV-86933r2_rule" tag stig_id: "RHEL-07-040740" tag fix_id: "F-78663r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe kernel_parameter('net.ipv4.ip_forward') do its('value') { should eq 0 } end end
Pluggable authentication modules (PAM) allow for a modular approach to integrating authentication methods. PAM operates in a top-down processing model and if the modules are not listed in the correct order, an important security function could be bypassed if stack entries are not centralized.
Test Results

Status passed
Test /etc/pam.d/passwd substacks system-auth
Result
Result Details

Control V-81003
Title The Red Hat Enterprise Linux operating system must be configured so that /etc/pam.d/passwd implements /etc/pam.d/system-auth when changing passwords.
Desc Pluggable authentication modules (PAM) allow for a modular approach to integrating authentication methods. PAM operates in a top-down processing model and if the modules are not listed in the correct order, an important security function could be bypassed if stack entries are not centralized.
Severity medium
Impact 0.5
Nist Controls IA-5 (1) (a), Rev_4
Check Text Verify that /etc/pam.d/passwd is configured to use /etc/pam.d/system-auth when changing passwords: # cat /etc/pam.d/passwd | grep -i substack | grep -i system-auth password substack system-auth If no results are returned, the line is commented out, this is a finding.
Fix Text Configure PAM to utilize /etc/pam.d/system-auth when changing passwords. Add the following line to "/etc/pam.d/passwd" (or modify the line to have the required value): password substack system-auth

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-81003" do title "The Red Hat Enterprise Linux operating system must be configured so that /etc/pam.d/passwd implements /etc/pam.d/system-auth when changing passwords." desc "Pluggable authentication modules (PAM) allow for a modular approach to integrating authentication methods. PAM operates in a top-down processing model and if the modules are not listed in the correct order, an important security function could be bypassed if stack entries are not centralized." desc "rationale", "" desc "check", " Verify that /etc/pam.d/passwd is configured to use /etc/pam.d/system-auth when changing passwords: # cat /etc/pam.d/passwd | grep -i substack | grep -i system-auth password substack system-auth If no results are returned, the line is commented out, this is a finding. " desc "fix", " Configure PAM to utilize /etc/pam.d/system-auth when changing passwords. Add the following line to \"/etc/pam.d/passwd\" (or modify the line to have the required value): password substack system-auth " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000069-GPOS-00037" tag gid: "V-81003" tag rid: "SV-95715r1_rule" tag stig_id: "RHEL-07-010118" tag fix_id: "F-87837r1_fix" tag cci: ["CCI-000192"] tag nist: ["IA-5 (1) (a)", "Rev_4"] # Get the content of /etc/pam.d/passwd as an array pam_passwd_content = file('/etc/pam.d/passwd').content.strip.split("\n") # Make a new array of any line matching the target pattern: # /password\s+substack\s+system-auth matching_lines = pam_passwd_content.select { |i| i.match(/password\s+substack\s+system-auth/) } describe '/etc/pam.d/passwd' do subject { matching_lines } it 'substacks system-auth' do expect(subject.length).to(eql 1) end end end
If the Group Identifier (GID) of a local interactive user's home directory is not the same as the primary GID of the user, this would allow unauthorized access to the user's files, and users that share the same group may not be able to access files that they legitimately should.
Test Results

Status passed
Test Home directories that are not group-owned by the user's primary GID is expected to be empty
Result
Result Details

Control V-72021
Title The Red Hat Enterprise Linux operating system must be configured so that all local interactive user home directories are group-owned by the home directory owners primary group.
Desc If the Group Identifier (GID) of a local interactive user's home directory is not the same as the primary GID of the user, this would allow unauthorized access to the user's files, and users that share the same group may not be able to access files that they legitimately should.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the assigned home directory of all local interactive users is group-owned by that user's primary GID. Check the home directory assignment for all local interactive users on the system with the following command: # ls -ld $(egrep ':[0-9]{4}' /etc/passwd | cut -d: -f6) -rwxr-x--- 1 smithj users 18 Mar 5 17:06 /home/smithj Check the user's primary group with the following command: # grep users /etc/group users:x:250:smithj,jonesj,jacksons If the user home directory referenced in "/etc/passwd" is not group-owned by that user's primary GID, this is a finding.
Fix Text Change the group owner of a local interactive user's home directory to the group found in "/etc/passwd". To change the group owner of a local interactive user's home directory, use the following command: Note: The example will be for the user "smithj", who has a home directory of "/home/smithj", and has a primary group of users. # chgrp users /home/smithj

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72021" do title "The Red Hat Enterprise Linux operating system must be configured so that all local interactive user home directories are group-owned by the home directory owners primary group." desc "If the Group Identifier (GID) of a local interactive user's home directory is not the same as the primary GID of the user, this would allow unauthorized access to the user's files, and users that share the same group may not be able to access files that they legitimately should." desc "rationale", "" desc "check", " Verify the assigned home directory of all local interactive users is group-owned by that user's primary GID. Check the home directory assignment for all local interactive users on the system with the following command: # ls -ld $(egrep ':[0-9]{4}' /etc/passwd | cut -d: -f6) -rwxr-x--- 1 smithj users 18 Mar 5 17:06 /home/smithj Check the user's primary group with the following command: # grep users /etc/group users:x:250:smithj,jonesj,jacksons If the user home directory referenced in \"/etc/passwd\" is not group-owned by that user's primary GID, this is a finding. " desc "fix", " Change the group owner of a local interactive user's home directory to the group found in \"/etc/passwd\". To change the group owner of a local interactive user's home directory, use the following command: Note: The example will be for the user \"smithj\", who has a home directory of \"/home/smithj\", and has a primary group of users. # chgrp users /home/smithj " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72021" tag rid: "SV-86645r5_rule" tag stig_id: "RHEL-07-020650" tag fix_id: "F-78373r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] exempt_home_users = input('exempt_home_users') non_interactive_shells = input('non_interactive_shells') ignore_shells = non_interactive_shells.join('|') uid_min = login_defs.read_params['UID_MIN'].to_i uid_min = 1000 if uid_min.nil? findings = Set[] users.where{ !shell.match(ignore_shells) && (uid >= uid_min || uid == 0)}.entries.each do |user_info| next if exempt_home_users.include?("#{user_info.username}") findings = findings + command("find #{user_info.home} -maxdepth 0 -not -gid #{user_info.gid}").stdout.split("\n") end describe "Home directories that are not group-owned by the user's primary GID" do subject { findings.to_a } it { should be_empty } end end
Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Test Results

Status passed
Test Auditd Rules with file == "/usr/bin/crontab" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/usr/bin/crontab" action is expected not to include "never"
Result
Status passed
Test ["x"] is expected to include "x"
Result
Result Details

Control V-72183
Title The Red Hat Enterprise Linux operating system must audit all uses of the crontab command.
Desc Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Severity medium
Impact 0.5
Nist Controls AU-3 (1), AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "crontab" command occur. Check that the following system call is being audited by performing the following command to check the file system rules in "/etc/audit/audit.rules": # grep -iw /usr/bin/crontab /etc/audit/audit.rules -a always,exit -F path=/usr/bin/crontab -F auid>=1000 -F auid!=4294967295 -k privileged-cron If the command does not return any output, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "crontab" command occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules": -a always,exit -F path=/usr/bin/crontab -F auid>=1000 -F auid!=4294967295 -k privileged-cron The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72183" do title "The Red Hat Enterprise Linux operating system must audit all uses of the crontab command." desc "Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise. " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"crontab\" command occur. Check that the following system call is being audited by performing the following command to check the file system rules in \"/etc/audit/audit.rules\": # grep -iw /usr/bin/crontab /etc/audit/audit.rules -a always,exit -F path=/usr/bin/crontab -F auid>=1000 -F auid!=4294967295 -k privileged-cron If the command does not return any output, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"crontab\" command occur. Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F path=/usr/bin/crontab -F auid>=1000 -F auid!=4294967295 -k privileged-cron The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000042-GPOS-00020" tag satisfies: ["SRG-OS-000042-GPOS-00020", "SRG-OS-000392-GPOS-00172", "SRG-OS-000471-GPOS-00215"] tag gid: "V-72183" tag rid: "SV-86807r3_rule" tag stig_id: "RHEL-07-030800" tag fix_id: "F-78537r4_fix" tag cci: ["CCI-000135", "CCI-000172", "CCI-002884"] tag nist: ["AU-3 (1)", "AU-12 c", "MA-4 (1) (a)", "Rev_4"] audit_file = '/usr/bin/crontab' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'x' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
Information stored in one location is vulnerable to accidental or incidental deletion or alteration. Off-loading is a common process in information systems with limited audit storage capacity.
Test Results

Status skipped
Test File '/etc/audisp/audisp-remote.conf' cannot be found. This test cannot be checked in a automated fashion and you must check it manually
Result
Result Details

Control V-72083
Title The Red Hat Enterprise Linux operating system must off-load audit records onto a different system or media from the system being audited.
Desc Information stored in one location is vulnerable to accidental or incidental deletion or alteration. Off-loading is a common process in information systems with limited audit storage capacity.
Severity medium
Impact 0.5
Nist Controls AU-4 (1), Rev_4
Check Text Verify the operating system off-loads audit records onto a different system or media from the system being audited. To determine the remote server that the records are being sent to, use the following command: # grep -i remote_server /etc/audisp/audisp-remote.conf remote_server = 10.0.21.1 If a remote server is not configured, or the line is commented out, ask the System Administrator to indicate how the audit logs are off-loaded to a different system or media. If there is no evidence that the audit logs are being off-loaded to another system or media, this is a finding.
Fix Text Configure the operating system to off-load audit records onto a different system or media from the system being audited. Set the remote server option in "/etc/audisp/audisp-remote.conf" with the IP address of the log aggregation server.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72083" do title "The Red Hat Enterprise Linux operating system must off-load audit records onto a different system or media from the system being audited." desc "Information stored in one location is vulnerable to accidental or incidental deletion or alteration. Off-loading is a common process in information systems with limited audit storage capacity. " desc "rationale", "" desc "check", " Verify the operating system off-loads audit records onto a different system or media from the system being audited. To determine the remote server that the records are being sent to, use the following command: # grep -i remote_server /etc/audisp/audisp-remote.conf remote_server = 10.0.21.1 If a remote server is not configured, or the line is commented out, ask the System Administrator to indicate how the audit logs are off-loaded to a different system or media. If there is no evidence that the audit logs are being off-loaded to another system or media, this is a finding. " desc "fix", " Configure the operating system to off-load audit records onto a different system or media from the system being audited. Set the remote server option in \"/etc/audisp/audisp-remote.conf\" with the IP address of the log aggregation server. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000342-GPOS-00133" tag satisfies: ["SRG-OS-000342-GPOS-00133", "SRG-OS-000479-GPOS-00224"] tag gid: "V-72083" tag rid: "SV-86707r2_rule" tag stig_id: "RHEL-07-030300" tag fix_id: "F-78435r1_fix" tag cci: ["CCI-001851"] tag nist: ["AU-4 (1)", "Rev_4"] if file('/etc/audisp/audisp-remote.conf').exist? describe parse_config_file('/etc/audisp/audisp-remote.conf') do its('remote_server'.to_s) { should match %r{^\S+$} } its('remote_server'.to_s) { should_not be_in ['localhost', '127.0.0.1'] } end else describe "File '/etc/audisp/audisp-remote.conf' cannot be found. This test cannot be checked in a automated fashion and you must check it manually" do skip "File '/etc/audisp/audisp-remote.conf' cannot be found. This check must be performed manually" end end end
Providing users with feedback on when account accesses via SSH last occurred facilitates user recognition and reporting of unauthorized account use.
Test Results

Status passed
Test SSHD Configuration PrintLastLog is expected to cmp == "yes"
Result
Result Details

Control V-72245
Title The Red Hat Enterprise Linux operating system must display the date and time of the last successful account logon upon an SSH logon.
Desc Providing users with feedback on when account accesses via SSH last occurred facilitates user recognition and reporting of unauthorized account use.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify SSH provides users with feedback on when account accesses last occurred. Check that "PrintLastLog" keyword in the sshd daemon configuration file is used and set to "yes" with the following command: # grep -i printlastlog /etc/ssh/sshd_config PrintLastLog yes If the "PrintLastLog" keyword is set to "no", is missing, or is commented out, this is a finding.
Fix Text Configure SSH to provide users with feedback on when account accesses last occurred by setting the required configuration options in "/etc/pam.d/sshd" or in the "sshd_config" file used by the system ("/etc/ssh/sshd_config" will be used in the example) (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor). Modify the "PrintLastLog" line in "/etc/ssh/sshd_config" to match the following: PrintLastLog yes The SSH service must be restarted for changes to "sshd_config" to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72245" do title "The Red Hat Enterprise Linux operating system must display the date and time of the last successful account logon upon an SSH logon." desc "Providing users with feedback on when account accesses via SSH last occurred facilitates user recognition and reporting of unauthorized account use." desc "rationale", "" desc "check", " Verify SSH provides users with feedback on when account accesses last occurred. Check that \"PrintLastLog\" keyword in the sshd daemon configuration file is used and set to \"yes\" with the following command: # grep -i printlastlog /etc/ssh/sshd_config PrintLastLog yes If the \"PrintLastLog\" keyword is set to \"no\", is missing, or is commented out, this is a finding. " desc "fix", " Configure SSH to provide users with feedback on when account accesses last occurred by setting the required configuration options in \"/etc/pam.d/sshd\" or in the \"sshd_config\" file used by the system (\"/etc/ssh/sshd_config\" will be used in the example) (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor). Modify the \"PrintLastLog\" line in \"/etc/ssh/sshd_config\" to match the following: PrintLastLog yes The SSH service must be restarted for changes to \"sshd_config\" to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72245" tag rid: "SV-86869r3_rule" tag stig_id: "RHEL-07-040360" tag fix_id: "F-78599r3_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] if sshd_config.params['printlastlog'] == ['yes'] describe sshd_config do its('PrintLastLog') { should cmp 'yes' } end else describe pam('/etc/pam.d/sshd') do its('lines') { should match_pam_rule('session required pam_lastlog.so showfailed') } its('lines') { should match_pam_rule('session required pam_lastlog.so showfailed').all_without_args('silent') } end end end
Failure to restrict system access to authenticated users negatively impacts operating system security.
Test Results

Status passed
Test SSHD Configuration HostbasedAuthentication is expected to eq "no"
Result
Result Details

Control V-71959
Title The Red Hat Enterprise Linux operating system must not allow a non-certificate trusted host SSH logon to the system.
Desc Failure to restrict system access to authenticated users negatively impacts operating system security.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the operating system does not allow a non-certificate trusted host SSH logon to the system. Check for the value of the "HostbasedAuthentication" keyword with the following command: # grep -i hostbasedauthentication /etc/ssh/sshd_config HostbasedAuthentication no If the "HostbasedAuthentication" keyword is not set to "no", is missing, or is commented out, this is a finding.
Fix Text Configure the operating system to not allow a non-certificate trusted host SSH logon to the system. Edit the "/etc/ssh/sshd_config" file to uncomment or add the line for "HostbasedAuthentication" keyword and set the value to "no": HostbasedAuthentication no The SSH service must be restarted for changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71959" do title "The Red Hat Enterprise Linux operating system must not allow a non-certificate trusted host SSH logon to the system." desc "Failure to restrict system access to authenticated users negatively impacts operating system security." desc "rationale", "" desc "check", " Verify the operating system does not allow a non-certificate trusted host SSH logon to the system. Check for the value of the \"HostbasedAuthentication\" keyword with the following command: # grep -i hostbasedauthentication /etc/ssh/sshd_config HostbasedAuthentication no If the \"HostbasedAuthentication\" keyword is not set to \"no\", is missing, or is commented out, this is a finding. " desc "fix", " Configure the operating system to not allow a non-certificate trusted host SSH logon to the system. Edit the \"/etc/ssh/sshd_config\" file to uncomment or add the line for \"HostbasedAuthentication\" keyword and set the value to \"no\": HostbasedAuthentication no The SSH service must be restarted for changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00229" tag gid: "V-71959" tag rid: "SV-86583r3_rule" tag stig_id: "RHEL-07-010470" tag fix_id: "F-78311r3_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe sshd_config do its('HostbasedAuthentication') { should eq 'no' } end end
Source-routed packets allow the source of the packet to suggest that routers forward the packet along a different path than configured on the router, which can be used to bypass network security measures. This requirement applies only to the forwarding of source-routed traffic, such as when IPv4 forwarding is enabled and the system is functioning as a router.
Test Results

Status passed
Test Kernel Parameter net.ipv4.conf.default.accept_source_route value is expected to eq 0
Result
Result Details

Control V-72285
Title The Red Hat Enterprise Linux operating system must not forward Internet Protocol version 4 (IPv4) source-routed packets by default.
Desc Source-routed packets allow the source of the packet to suggest that routers forward the packet along a different path than configured on the router, which can be used to bypass network security measures. This requirement applies only to the forwarding of source-routed traffic, such as when IPv4 forwarding is enabled and the system is functioning as a router.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the system does not accept IPv4 source-routed packets by default. # grep net.ipv4.conf.default.accept_source_route /etc/sysctl.conf /etc/sysctl.d/* net.ipv4.conf.default.accept_source_route = 0 If " net.ipv4.conf.default.accept_source_route " is not configured in the /etc/sysctl.conf file or in the /etc/sysctl.d/ directory, is commented out, or does not have a value of "0", this is a finding. Check that the operating system implements the accept source route variable with the following command: # /sbin/sysctl -a | grep net.ipv4.conf.default.accept_source_route net.ipv4.conf.default.accept_source_route = 0 If the returned line does not have a value of "0", this is a finding.
Fix Text Set the system to the required kernel parameter by adding the following line to "/etc/sysctl.conf" or a configuration file in the /etc/sysctl.d/ directory (or modify the line to have the required value): net.ipv4.conf.default.accept_source_route = 0 Issue the following command to make the changes take effect: # sysctl --system

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72285" do title "The Red Hat Enterprise Linux operating system must not forward Internet Protocol version 4 (IPv4) source-routed packets by default." desc "Source-routed packets allow the source of the packet to suggest that routers forward the packet along a different path than configured on the router, which can be used to bypass network security measures. This requirement applies only to the forwarding of source-routed traffic, such as when IPv4 forwarding is enabled and the system is functioning as a router." desc "rationale", "" desc "check", " Verify the system does not accept IPv4 source-routed packets by default. # grep net.ipv4.conf.default.accept_source_route /etc/sysctl.conf /etc/sysctl.d/* net.ipv4.conf.default.accept_source_route = 0 If \" net.ipv4.conf.default.accept_source_route \" is not configured in the /etc/sysctl.conf file or in the /etc/sysctl.d/ directory, is commented out, or does not have a value of \"0\", this is a finding. Check that the operating system implements the accept source route variable with the following command: # /sbin/sysctl -a | grep net.ipv4.conf.default.accept_source_route net.ipv4.conf.default.accept_source_route = 0 If the returned line does not have a value of \"0\", this is a finding. " desc "fix", " Set the system to the required kernel parameter by adding the following line to \"/etc/sysctl.conf\" or a configuration file in the /etc/sysctl.d/ directory (or modify the line to have the required value): net.ipv4.conf.default.accept_source_route = 0 Issue the following command to make the changes take effect: # sysctl --system " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72285" tag rid: "SV-86909r2_rule" tag stig_id: "RHEL-07-040620" tag fix_id: "F-78639r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe kernel_parameter('net.ipv4.conf.default.accept_source_route') do its('value') { should eq 0 } end end
If a local interactive user's files are group-owned by a group of which the user is not a member, unintended users may be able to access them.
Test Results

Status passed
Test Home directory files with incorrect group ownership or not 'root' owned is expected to be empty
Result
Result Details

Control V-72025
Title The Red Hat Enterprise Linux operating system must be configured so that all files and directories contained in local interactive user home directories are group-owned by a group of which the home directory owner is a member.
Desc If a local interactive user's files are group-owned by a group of which the user is not a member, unintended users may be able to access them.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify all files and directories in a local interactive user home directory are group-owned by a group the user is a member of. Check the group owner of all files and directories in a local interactive user's home directory with the following command: Note: The example will be for the user "smithj", who has a home directory of "/home/smithj". # ls -lLR /<home directory>/<users home directory>/ -rw-r--r-- 1 smithj smithj 18 Mar 5 17:06 file1 -rw-r--r-- 1 smithj smithj 193 Mar 5 17:06 file2 -rw-r--r-- 1 smithj sa 231 Mar 5 17:06 file3 If any files are found with an owner different than the group home directory user, check to see if the user is a member of that group with the following command: # grep smithj /etc/group sa:x:100:juan,shelley,bob,smithj smithj:x:521:smithj If the user is not a member of a group that group owns file(s) in a local interactive user's home directory, this is a finding.
Fix Text Change the group of a local interactive user's files and directories to a group that the interactive user is a member of. To change the group owner of a local interactive user's files and directories, use the following command: Note: The example will be for the user smithj, who has a home directory of "/home/smithj" and is a member of the users group. # chgrp users /home/smithj/<file>

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72025" do title "The Red Hat Enterprise Linux operating system must be configured so that all files and directories contained in local interactive user home directories are group-owned by a group of which the home directory owner is a member." desc "If a local interactive user's files are group-owned by a group of which the user is not a member, unintended users may be able to access them." desc "rationale", "" desc "check", " Verify all files and directories in a local interactive user home directory are group-owned by a group the user is a member of. Check the group owner of all files and directories in a local interactive user's home directory with the following command: Note: The example will be for the user \"smithj\", who has a home directory of \"/home/smithj\". # ls -lLR /<home directory>/<users home directory>/ -rw-r--r-- 1 smithj smithj 18 Mar 5 17:06 file1 -rw-r--r-- 1 smithj smithj 193 Mar 5 17:06 file2 -rw-r--r-- 1 smithj sa 231 Mar 5 17:06 file3 If any files are found with an owner different than the group home directory user, check to see if the user is a member of that group with the following command: # grep smithj /etc/group sa:x:100:juan,shelley,bob,smithj smithj:x:521:smithj If the user is not a member of a group that group owns file(s) in a local interactive user's home directory, this is a finding. " desc "fix", " Change the group of a local interactive user's files and directories to a group that the interactive user is a member of. To change the group owner of a local interactive user's files and directories, use the following command: Note: The example will be for the user smithj, who has a home directory of \"/home/smithj\" and is a member of the users group. # chgrp users /home/smithj/<file> " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72025" tag rid: "SV-86649r2_rule" tag stig_id: "RHEL-07-020670" tag fix_id: "F-78377r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] exempt_home_users = input('exempt_home_users') non_interactive_shells = input('non_interactive_shells') ignore_shells = non_interactive_shells.join('|') uid_min = login_defs.read_params['UID_MIN'].to_i uid_min = 1000 if uid_min.nil? findings = Set[] users.where{ !shell.match(ignore_shells) && (uid >= uid_min || uid == 0)}.entries.each do |user_info| next if exempt_home_users.include?("#{user_info.username}") find_args = "" user_info.groups.each { |curr_group| # some key files and secure dirs (like .ssh) are group owned 'root' find_args = find_args + "-not -group #{curr_group} -o root" } findings = findings + command("find #{user_info.home} -xdev -xautofs #{find_args}").stdout.split("\n") end describe "Home directory files with incorrect group ownership or not 'root' owned" do subject { findings.to_a } it { should be_empty } end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with syscall == "init_module" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "init_module" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "init_module" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "init_module" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Result Details

Control V-72187
Title The Red Hat Enterprise Linux operating system must audit all uses of the init_module syscall.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-12 c, Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "init_module" syscall occur. Check the auditing rules in "/etc/audit/audit.rules" with the following command: # grep -iw init_module /etc/audit/audit.rules -a always,exit -F arch=b32 -S init_module -k module-change -a always,exit -F arch=b64 -S init_module -k module-change If both the "b32" and "b64" audit rules are not defined for the "init_module" syscall, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "init_module" syscall occur. Add or update the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S init_module -k module-change -a always,exit -F arch=b64 -S init_module -k module-change The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72187" do title "The Red Hat Enterprise Linux operating system must audit all uses of the init_module syscall." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"init_module\" syscall occur. Check the auditing rules in \"/etc/audit/audit.rules\" with the following command: # grep -iw init_module /etc/audit/audit.rules -a always,exit -F arch=b32 -S init_module -k module-change -a always,exit -F arch=b64 -S init_module -k module-change If both the \"b32\" and \"b64\" audit rules are not defined for the \"init_module\" syscall, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"init_module\" syscall occur. Add or update the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S init_module -k module-change -a always,exit -F arch=b64 -S init_module -k module-change The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000471-GPOS-00216" tag satisfies: ["SRG-OS-000471-GPOS-00216", "SRG-OS-000477-GPOS-00222"] tag gid: "V-72187" tag rid: "SV-86811r5_rule" tag stig_id: "RHEL-07-030820" tag fix_id: "F-78541r7_fix" tag cci: ["CCI-000172"] tag nist: ["AU-12 c", "Rev_4"] describe auditd.syscall("init_module").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end if os.arch == 'x86_64' describe auditd.syscall("init_module").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end end end
If security personnel are not notified immediately when the threshold for the repository maximum audit record storage capacity is reached, they are unable to expand the audit record storage capacity before records are lost.
Test Results

Status passed
Test Audit Daemon Config action_mail_acct is expected to cmp == "root"
Result
Result Details

Control V-72093
Title The Red Hat Enterprise Linux operating system must immediately notify the System Administrator (SA) and Information System Security Officer (ISSO) (at a minimum) when the threshold for the repository maximum audit record storage capacity is reached.
Desc If security personnel are not notified immediately when the threshold for the repository maximum audit record storage capacity is reached, they are unable to expand the audit record storage capacity before records are lost.
Severity medium
Impact 0.5
Nist Controls AU-5 (1), Rev_4
Check Text Verify the operating system immediately notifies the SA and ISSO (at a minimum) via email when the threshold for the repository maximum audit record storage capacity is reached. Check what account the operating system emails when the threshold for the repository maximum audit record storage capacity is reached with the following command: # grep -i action_mail_acct /etc/audit/auditd.conf action_mail_acct = root If the value of the "action_mail_acct" keyword is not set to "root" and other accounts for security personnel, this is a finding.
Fix Text Configure the operating system to immediately notify the SA and ISSO (at a minimum) when the threshold for the repository maximum audit record storage capacity is reached. Uncomment or edit the "action_mail_acct" keyword in "/etc/audit/auditd.conf" and set it to root and any other accounts associated with security personnel. action_mail_acct = root

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72093" do title "The Red Hat Enterprise Linux operating system must immediately notify the System Administrator (SA) and Information System Security Officer (ISSO) (at a minimum) when the threshold for the repository maximum audit record storage capacity is reached." desc "If security personnel are not notified immediately when the threshold for the repository maximum audit record storage capacity is reached, they are unable to expand the audit record storage capacity before records are lost." desc "rationale", "" desc "check", " Verify the operating system immediately notifies the SA and ISSO (at a minimum) via email when the threshold for the repository maximum audit record storage capacity is reached. Check what account the operating system emails when the threshold for the repository maximum audit record storage capacity is reached with the following command: # grep -i action_mail_acct /etc/audit/auditd.conf action_mail_acct = root If the value of the \"action_mail_acct\" keyword is not set to \"root\" and other accounts for security personnel, this is a finding. " desc "fix", " Configure the operating system to immediately notify the SA and ISSO (at a minimum) when the threshold for the repository maximum audit record storage capacity is reached. Uncomment or edit the \"action_mail_acct\" keyword in \"/etc/audit/auditd.conf\" and set it to root and any other accounts associated with security personnel. action_mail_acct = root " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000343-GPOS-00134" tag gid: "V-72093" tag rid: "SV-86717r3_rule" tag stig_id: "RHEL-07-030350" tag fix_id: "F-78445r3_fix" tag cci: ["CCI-001855"] tag nist: ["AU-5 (1)", "Rev_4"] describe auditd_conf do its('action_mail_acct') { should cmp 'root' } end end
If the system is not configured to audit certain activities and write them to an audit log, it is more difficult to detect and track system compromises and damages incurred during a system compromise.
Test Results

Status passed
Test Auditd Rules with syscall == "renameat" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "renameat" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "renameat" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "renameat" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Result Details

Control V-72201
Title The Red Hat Enterprise Linux operating system must audit all uses of the renameat syscall.
Desc If the system is not configured to audit certain activities and write them to an audit log, it is more difficult to detect and track system compromises and damages incurred during a system compromise.
Severity medium
Impact 0.5
Nist Controls AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "renameat" syscall occur. Check the file system rules in "/etc/audit/audit.rules" with the following commands: # grep -iw renameat /etc/audit/audit.rules -a always,exit -F arch=b32 -S renameat -F auid>=1000 -F auid!=4294967295 -k delete -a always,exit -F arch=b64 -S renameat -F auid>=1000 -F auid!=4294967295 -k delete If both the "b32" and "b64" audit rules are not defined for the "renameat" syscall, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "renameat" syscall occur. Add the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S renameat -F auid>=1000 -F auid!=4294967295 -k delete -a always,exit -F arch=b64 -S renameat -F auid>=1000 -F auid!=4294967295 -k delete The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72201" do title "The Red Hat Enterprise Linux operating system must audit all uses of the renameat syscall." desc "If the system is not configured to audit certain activities and write them to an audit log, it is more difficult to detect and track system compromises and damages incurred during a system compromise. " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"renameat\" syscall occur. Check the file system rules in \"/etc/audit/audit.rules\" with the following commands: # grep -iw renameat /etc/audit/audit.rules -a always,exit -F arch=b32 -S renameat -F auid>=1000 -F auid!=4294967295 -k delete -a always,exit -F arch=b64 -S renameat -F auid>=1000 -F auid!=4294967295 -k delete If both the \"b32\" and \"b64\" audit rules are not defined for the \"renameat\" syscall, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"renameat\" syscall occur. Add the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S renameat -F auid>=1000 -F auid!=4294967295 -k delete -a always,exit -F arch=b64 -S renameat -F auid>=1000 -F auid!=4294967295 -k delete The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000466-GPOS-00210" tag satisfies: ["SRG-OS-000466-GPOS-00210", "SRG-OS-000467-GPOS-00210", "SRG-OS-000468-GPOS-00212", "SRG-OS-000392-GPOS-00172"] tag gid: "V-72201" tag rid: "SV-86825r5_rule" tag stig_id: "RHEL-07-030890" tag fix_id: "F-78555r8_fix" tag cci: ["CCI-000172", "CCI-002884"] tag nist: ["AU-12 c", "MA-4 (1) (a)", "Rev_4"] describe auditd.syscall("renameat").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end if os.arch == 'x86_64' describe auditd.syscall("renameat").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end end end
The executable search path (typically the PATH environment variable) contains a list of directories for the shell to search to find executables. If this path includes the current working directory (other than the user's home directory), executables in these directories may be executed instead of system commands. This variable is formatted as a colon-separated list of directories. If there is an empty entry, such as a leading or trailing colon or two consecutive colons, this is interpreted as the current working directory. If deviations from the default system search path for the local interactive user are required, they must be documented with the Information System Security Officer (ISSO).
Test Results

Status passed
Test Initialization files that include executable search paths that include directories outside their home directories is expected to be empty
Result
Result Details

Control V-72035
Title The Red Hat Enterprise Linux operating system must be configured so that all local interactive user initialization files executable search paths contain only paths that resolve to the users home directory.
Desc The executable search path (typically the PATH environment variable) contains a list of directories for the shell to search to find executables. If this path includes the current working directory (other than the user's home directory), executables in these directories may be executed instead of system commands. This variable is formatted as a colon-separated list of directories. If there is an empty entry, such as a leading or trailing colon or two consecutive colons, this is interpreted as the current working directory. If deviations from the default system search path for the local interactive user are required, they must be documented with the Information System Security Officer (ISSO).
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify that all local interactive user initialization files' executable search path statements do not contain statements that will reference a working directory other than the users' home directory. Check the executable search path statement for all local interactive user initialization files in the users' home directory with the following commands: Note: The example will be for the smithj user, which has a home directory of "/home/smithj". # grep -i path /home/smithj/.* /home/smithj/.bash_profile:PATH=$PATH:$HOME/.local/bin:$HOME/bin /home/smithj/.bash_profile:export PATH If any local interactive user initialization files have executable search path statements that include directories outside of their home directory, this is a finding.
Fix Text Edit the local interactive user initialization files to change any PATH variable statements that reference directories other than their home directory. If a local interactive user requires path variables to reference a directory owned by the application, it must be documented with the ISSO.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72035" do title "The Red Hat Enterprise Linux operating system must be configured so that all local interactive user initialization files executable search paths contain only paths that resolve to the users home directory." desc "The executable search path (typically the PATH environment variable) contains a list of directories for the shell to search to find executables. If this path includes the current working directory (other than the user's home directory), executables in these directories may be executed instead of system commands. This variable is formatted as a colon-separated list of directories. If there is an empty entry, such as a leading or trailing colon or two consecutive colons, this is interpreted as the current working directory. If deviations from the default system search path for the local interactive user are required, they must be documented with the Information System Security Officer (ISSO)." desc "rationale", "" desc "check", " Verify that all local interactive user initialization files' executable search path statements do not contain statements that will reference a working directory other than the users' home directory. Check the executable search path statement for all local interactive user initialization files in the users' home directory with the following commands: Note: The example will be for the smithj user, which has a home directory of \"/home/smithj\". # grep -i path /home/smithj/.* /home/smithj/.bash_profile:PATH=$PATH:$HOME/.local/bin:$HOME/bin /home/smithj/.bash_profile:export PATH If any local interactive user initialization files have executable search path statements that include directories outside of their home directory, this is a finding. " desc "fix", " Edit the local interactive user initialization files to change any PATH variable statements that reference directories other than their home directory. If a local interactive user requires path variables to reference a directory owned by the application, it must be documented with the ISSO. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72035" tag rid: "SV-86659r4_rule" tag stig_id: "RHEL-07-020720" tag fix_id: "F-78387r4_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] exempt_home_users = input('exempt_home_users') non_interactive_shells = input('non_interactive_shells') ignore_shells = non_interactive_shells.join('|') findings = Set[] users.where{ !shell.match(ignore_shells) && (uid >= 1000 || uid == 0)}.entries.each do |user_info| next if exempt_home_users.include?("#{user_info.username}") grep_results = command("grep -i path --exclude=\".bash_history\" #{user_info.home}/.*").stdout.split("\\n") grep_results.each do |result| result.slice! "PATH=" # Case when last value in exec search path is : if result[-1] == ":" then result = result + " " end result.slice! "$PATH:" result.gsub! '$HOME', "#{user_info.home}" result.gsub! '~', "#{user_info.home}" line_arr = result.split(":") line_arr.delete_at(0) line_arr.each do |line| # Don't run test on line that exports PATH and is not commented out if !line.start_with?('export') && !line.start_with?('#') then # Case when :: found in exec search path or : found at beginning if line.strip.empty? then curr_work_dir = command("pwd").stdout.gsub("\n", "") if curr_work_dir.start_with?("#{user_info.home}") then line = curr_work_dir end end # This will fail if non-home directory found in path if !line.start_with?(user_info.home) findings.add(line) end end end end end describe.one do describe etc_fstab do its('home_mount_options') { should include 'nosuid' } end describe "Initialization files that include executable search paths that include directories outside their home directories" do subject { findings.to_a } it { should be_empty } end end end
Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised.
Test Results

Status passed
Test Parse Config File /etc/security/pwquality.conf maxclassrepeat.to_i is expected to cmp <= 4
Result
Result Details

Control V-71917
Title The Red Hat Enterprise Linux operating system must be configured so that when passwords are changed the number of repeating characters of the same character class must not be more than four characters.
Desc Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised.
Severity medium
Impact 0.5
Nist Controls IA-5 (1) (b), Rev_4
Check Text The "maxclassrepeat" option sets the maximum number of allowed same consecutive characters in the same class in the new password. Check for the value of the "maxclassrepeat" option in "/etc/security/pwquality.conf" with the following command: # grep maxclassrepeat /etc/security/pwquality.conf maxclassrepeat = 4 If the value of "maxclassrepeat" is set to more than "4", this is a finding.
Fix Text Configure the operating system to require the change of the number of repeating characters of the same character class when passwords are changed by setting the "maxclassrepeat" option. Add the following line to "/etc/security/pwquality.conf" conf (or modify the line to have the required value): maxclassrepeat = 4

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71917" do title "The Red Hat Enterprise Linux operating system must be configured so that when passwords are changed the number of repeating characters of the same character class must not be more than four characters." desc "Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised. " desc "rationale", "" desc "check", " The \"maxclassrepeat\" option sets the maximum number of allowed same consecutive characters in the same class in the new password. Check for the value of the \"maxclassrepeat\" option in \"/etc/security/pwquality.conf\" with the following command: # grep maxclassrepeat /etc/security/pwquality.conf maxclassrepeat = 4 If the value of \"maxclassrepeat\" is set to more than \"4\", this is a finding. " desc "fix", " Configure the operating system to require the change of the number of repeating characters of the same character class when passwords are changed by setting the \"maxclassrepeat\" option. Add the following line to \"/etc/security/pwquality.conf\" conf (or modify the line to have the required value): maxclassrepeat = 4 " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000072-GPOS-00040" tag gid: "V-71917" tag rid: "SV-86541r2_rule" tag stig_id: "RHEL-07-010190" tag fix_id: "F-78269r1_fix" tag cci: ["CCI-000195"] tag nist: ["IA-5 (1) (b)", "Rev_4"] describe parse_config_file("/etc/security/pwquality.conf") do its('maxclassrepeat.to_i') { should cmp <= 4 } end end
Display of a standardized and approved use notification before granting access to the publicly accessible operating system ensures privacy and security notification verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. System use notifications are required only for access via logon interfaces with human users and are not required when such human interfaces do not exist. The banner must be formatted in accordance with applicable DoD policy. Use the following verbiage for operating systems that can accommodate banners of 1300 characters: "You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. By using this IS (which includes any device attached to this IS), you consent to the following conditions: -The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations. -At any time, the USG may inspect and seize data stored on this IS. -Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose. -This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy. -Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details."
Test Results

Status passed
Test The SSHD Banner is set to the standard banner and has the correct text is expected to cmp == "YouareaccessingaU.S.Government(USG)InformationSystem(IS)thatisprovidedforUSG-authorizeduseonly.ByusingthisIS(whichincludesanydeviceattachedtothisIS),youconsenttothefollowingconditions:-TheUSGroutinelyinterceptsandmonitorscommunicationsonthisISforpurposesincluding,butnotlimitedto,penetrationtesting,COMSECmonitoring,networkoperationsanddefense,personnelmisconduct(PM),lawenforcement(LE),andcounterintelligence(CI)investigations.-Atanytime,theUSGmayinspectandseizedatastoredonthisIS.-Communicationsusing,ordatastoredon,thisISarenotprivate,aresubjecttoroutinemonitoring,interception,andsearch,andmaybedisclosedorusedforanyUSG-authorizedpurpose.-ThisISincludessecuritymeasures(e.g.,authenticationandaccesscontrols)toprotectUSGinterests--notforyourpersonalbenefitorprivacy.-Notwithstandingtheabove,usingthisISdoesnotconstituteconsenttoPM,LEorCIinvestigativesearchingormonitoringofthecontentofprivilegedcommunications,orworkproduct,relatedtopersonalrepresentationorservicesbyattorneys,psychotherapists,orclergy,andtheirassistants.Suchcommunicationsandworkproductareprivateandconfidential.SeeUserAgreementfordetails."
Result expected: YouareaccessingaU.S.Government(USG)InformationSystem(IS)thatisprovidedforUSG-authorizeduseonly.ByusingthisIS(whichincludesanydeviceattachedtothisIS),youconsenttothefollowingconditions:-TheUSGroutinelyinterceptsandmonitorscommunicationsonthisISforpurposesincluding,butnotlimitedto,penetrationtesting,COMSECmonitoring,networkoperationsanddefense,personnelmisconduct(PM),lawenforcement(LE),andcounterintelligence(CI)investigations.-Atanytime,theUSGmayinspectandseizedatastoredonthisIS.-Communicationsusing,ordatastoredon,thisISarenotprivate,aresubjecttoroutinemonitoring,interception,andsearch,andmaybedisclosedorusedforanyUSG-authorizedpurpose.-ThisISincludessecuritymeasures(e.g.,authenticationandaccesscontrols)toprotectUSGinterests--notforyourpersonalbenefitorprivacy.-Notwithstandingtheabove,usingthisISdoesnotconstituteconsenttoPM,LEorCIinvestigativesearchingormonitoringofthecontentofprivilegedcommunications,orworkproduct,relatedtopersonalrepresentationorservicesbyattorneys,psychotherapists,orclergy,andtheirassistants.Suchcommunicationsandworkproductareprivateandconfidential.SeeUserAgreementfordetails. got: YouareaccessingaU.S.Government(USG)informationsystem(IS)thatisprovidedforUSG-authorizeduseonly.ByusingthisIS(whichincludesanydeviceattachedtothisIS)youconsenttothefollowingconditions:-TheUSGroutinelyinterceptsandmonitorscommunicationsonthisISforpurposesincluding,butnotlimitedto,penetrationtesting,COMSECmonitoring,networkoperationsanddefense,personnelmisconduct(PM),lawenforcement(LE),andcounterintelligence(CI)investigations.-Atanytime,theUSGmayinspectandseizedatastoredonthisIS.-Communicationsusing,ordatastoredon,thisISarenotprivate,aresubjecttoroutinemonitoring,interception,andsearch,andmaybedisclosedorusedforanyUSG-authorizedpurpose.-ThisISincludessecuritymeasures(e.g.,authenticationandaccesscontrols)toprotectUSGinterests--notforyourpersonalbenefitorprivacy.-Notwithstandingtheabove,usingthisISdoesnotconstituteconsenttoPM,LEorCIinvestigativesearchingormonitoringofthecontentofprivilegedcommunications,orworkproduct,relatedtopersonalrepresentationorservicesbyattorneys,psychotherapists,orclergy,andtheirassistants.Suchcommunicationsandworkproductareprivateandconfidential.SeeUserAgreementfordetails. (compared using `cmp` matcher)
Status passed
Test The SSHD Banner is set to the standard limited banner and has the correct text is expected to cmp == "I'veread&consenttotermsinISuseragreem't."
Result expected: I'veread&consenttotermsinISuseragreem't. got: YouareaccessingaU.S.Government(USG)informationsystem(IS)thatisprovidedforUSG-authorizeduseonly.ByusingthisIS(whichincludesanydeviceattachedtothisIS)youconsenttothefollowingconditions:-TheUSGroutinelyinterceptsandmonitorscommunicationsonthisISforpurposesincluding,butnotlimitedto,penetrationtesting,COMSECmonitoring,networkoperationsanddefense,personnelmisconduct(PM),lawenforcement(LE),andcounterintelligence(CI)investigations.-Atanytime,theUSGmayinspectandseizedatastoredonthisIS.-Communicationsusing,ordatastoredon,thisISarenotprivate,aresubjecttoroutinemonitoring,interception,andsearch,andmaybedisclosedorusedforanyUSG-authorizedpurpose.-ThisISincludessecuritymeasures(e.g.,authenticationandaccesscontrols)toprotectUSGinterests--notforyourpersonalbenefitorprivacy.-Notwithstandingtheabove,usingthisISdoesnotconstituteconsenttoPM,LEorCIinvestigativesearchingormonitoringofthecontentofprivilegedcommunications,orworkproduct,relatedtopersonalrepresentationorservicesbyattorneys,psychotherapists,orclergy,andtheirassistants.Suchcommunicationsandworkproductareprivateandconfidential.SeeUserAgreementfordetails. (compared using `cmp` matcher)
Result Details

Control V-72225
Title The Red Hat Enterprise Linux operating system must display the Standard Mandatory DoD Notice and Consent Banner immediately prior to, or as part of, remote access logon prompts.
Desc Display of a standardized and approved use notification before granting access to the publicly accessible operating system ensures privacy and security notification verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. System use notifications are required only for access via logon interfaces with human users and are not required when such human interfaces do not exist. The banner must be formatted in accordance with applicable DoD policy. Use the following verbiage for operating systems that can accommodate banners of 1300 characters: "You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. By using this IS (which includes any device attached to this IS), you consent to the following conditions: -The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations. -At any time, the USG may inspect and seize data stored on this IS. -Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose. -This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy. -Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details."
Severity medium
Impact 0.5
Nist Controls AC-8 a, AC-8 b, AC-8 c 1, AC-8 c 2, AC-8 c 2, AC-8 c 2, AC-8 c 3, Rev_4
Check Text Verify any publicly accessible connection to the operating system displays the Standard Mandatory DoD Notice and Consent Banner before granting access to the system. Check for the location of the banner file being used with the following command: # grep -i banner /etc/ssh/sshd_config banner /etc/issue This command will return the banner keyword and the name of the file that contains the ssh banner (in this case "/etc/issue"). If the line is commented out, this is a finding. View the file specified by the banner keyword to check that it matches the text of the Standard Mandatory DoD Notice and Consent Banner: "You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. By using this IS (which includes any device attached to this IS), you consent to the following conditions: -The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations. -At any time, the USG may inspect and seize data stored on this IS. -Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose. -This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy. -Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details." If the system does not display a graphical logon banner or the banner does not match the Standard Mandatory DoD Notice and Consent Banner, this is a finding. If the text in the file does not match the Standard Mandatory DoD Notice and Consent Banner, this is a finding.
Fix Text Configure the operating system to display the Standard Mandatory DoD Notice and Consent Banner before granting access to the system via the ssh. Edit the "/etc/ssh/sshd_config" file to uncomment the banner keyword and configure it to point to a file that will contain the logon banner (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor). An example configuration line is: banner /etc/issue Either create the file containing the banner or replace the text in the file with the Standard Mandatory DoD Notice and Consent Banner. The DoD required text is: "You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. By using this IS (which includes any device attached to this IS), you consent to the following conditions: -The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations. -At any time, the USG may inspect and seize data stored on this IS. -Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose. -This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy. -Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details." The SSH service must be restarted for changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72225" do title "The Red Hat Enterprise Linux operating system must display the Standard Mandatory DoD Notice and Consent Banner immediately prior to, or as part of, remote access logon prompts." desc "Display of a standardized and approved use notification before granting access to the publicly accessible operating system ensures privacy and security notification verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. System use notifications are required only for access via logon interfaces with human users and are not required when such human interfaces do not exist. The banner must be formatted in accordance with applicable DoD policy. Use the following verbiage for operating systems that can accommodate banners of 1300 characters: \"You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. By using this IS (which includes any device attached to this IS), you consent to the following conditions: -The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations. -At any time, the USG may inspect and seize data stored on this IS. -Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose. -This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy. -Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details.\" " desc "rationale", "" desc "check", " Verify any publicly accessible connection to the operating system displays the Standard Mandatory DoD Notice and Consent Banner before granting access to the system. Check for the location of the banner file being used with the following command: # grep -i banner /etc/ssh/sshd_config banner /etc/issue This command will return the banner keyword and the name of the file that contains the ssh banner (in this case \"/etc/issue\"). If the line is commented out, this is a finding. View the file specified by the banner keyword to check that it matches the text of the Standard Mandatory DoD Notice and Consent Banner: \"You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. By using this IS (which includes any device attached to this IS), you consent to the following conditions: -The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations. -At any time, the USG may inspect and seize data stored on this IS. -Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose. -This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy. -Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details.\" If the system does not display a graphical logon banner or the banner does not match the Standard Mandatory DoD Notice and Consent Banner, this is a finding. If the text in the file does not match the Standard Mandatory DoD Notice and Consent Banner, this is a finding. " desc "fix", " Configure the operating system to display the Standard Mandatory DoD Notice and Consent Banner before granting access to the system via the ssh. Edit the \"/etc/ssh/sshd_config\" file to uncomment the banner keyword and configure it to point to a file that will contain the logon banner (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor). An example configuration line is: banner /etc/issue Either create the file containing the banner or replace the text in the file with the Standard Mandatory DoD Notice and Consent Banner. The DoD required text is: \"You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. By using this IS (which includes any device attached to this IS), you consent to the following conditions: -The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations. -At any time, the USG may inspect and seize data stored on this IS. -Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose. -This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy. -Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details.\" The SSH service must be restarted for changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000023-GPOS-00006" tag satisfies: ["SRG-OS-000023-GPOS-00006", "SRG-OS-000024-GPOS-00007", "SRG-OS-000228-GPOS-00088"] tag gid: "V-72225" tag rid: "SV-86849r4_rule" tag stig_id: "RHEL-07-040170" tag fix_id: "F-78579r4_fix" tag cci: ["CCI-000048", "CCI-000050", "CCI-001384", "CCI-001385", "CCI-001386", "CCI-001387", "CCI-001388"] tag nist: ["AC-8 a", "AC-8 b", "AC-8 c 1", "AC-8 c 2", "AC-8 c 2", "AC-8 c 2", "AC-8 c 3", "Rev_4"] banner_message_text_ral = input('banner_message_text_ral') banner_message_text_ral_limited = input('banner_message_text_ral_limited') #When Banner is commented, not found, disabled, or the specified file does not exist, this is a finding. banner_files = [sshd_config.banner].flatten banner_files.each do |banner_file| #Banner property is commented out. describe "The SSHD Banner is not set" do subject { banner_file.nil? } it { should be false } end if banner_file.nil? #Banner property is set to "none" describe "The SSHD Banner is disabled" do subject { banner_file.match(/none/i).nil? } it { should be true } end if !banner_file.nil? && !banner_file.match(/none/i).nil? #Banner property provides a path to a file, however, it does not exist. describe "The SSHD Banner is set, but, the file does not exist" do subject { file(banner_file).exist? } it { should be true } end if !banner_file.nil? && banner_file.match(/none/i).nil? && !file(banner_file).exist? #Banner property provides a path to a file and it exists. describe.one do banner = file(banner_file).content.gsub(%r{[\r\n\s]}, '') clean_banner = banner_message_text_ral.gsub(%r{[\r\n\s]}, '') clean_banner_limited = banner_message_text_ral_limited.gsub(%r{[\r\n\s]}, '') describe "The SSHD Banner is set to the standard banner and has the correct text" do subject { banner } it { should cmp clean_banner } end describe "The SSHD Banner is set to the standard limited banner and has the correct text" do subject { banner } it { should cmp clean_banner_limited } end end if !banner_file.nil? && banner_file.match(/none/i).nil? && file(banner_file).exist? end end
If an unauthorized user obtains the private SSH host key file, the host could be impersonated.
Test Results

Status passed
Test No files have a more permissive mode. is expected to eq true
Result
Result Details

Control V-72257
Title The Red Hat Enterprise Linux operating system must be configured so that the SSH private host key files have mode 0640 or less permissive.
Desc If an unauthorized user obtains the private SSH host key file, the host could be impersonated.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the SSH private host key files have mode "0640" or less permissive. The following command will find all SSH private key files on the system and list their modes: # find / -name '*ssh_host*key' | xargs ls -lL -rw-r----- 1 root ssh_keys 668 Nov 28 06:43 ssh_host_dsa_key -rw-r----- 1 root ssh_keys 582 Nov 28 06:43 ssh_host_key -rw-r----- 1 root ssh_keys 887 Nov 28 06:43 ssh_host_rsa_key If any file has a mode more permissive than "0640", this is a finding.
Fix Text Configure the mode of SSH private host key files under "/etc/ssh" to "0640" with the following command: # chmod 0640 /path/to/file/ssh_host*key

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72257" do title "The Red Hat Enterprise Linux operating system must be configured so that the SSH private host key files have mode 0640 or less permissive." desc "If an unauthorized user obtains the private SSH host key file, the host could be impersonated." desc "rationale", "" desc "check", " Verify the SSH private host key files have mode \"0640\" or less permissive. The following command will find all SSH private key files on the system and list their modes: # find / -name '*ssh_host*key' | xargs ls -lL -rw-r----- 1 root ssh_keys 668 Nov 28 06:43 ssh_host_dsa_key -rw-r----- 1 root ssh_keys 582 Nov 28 06:43 ssh_host_key -rw-r----- 1 root ssh_keys 887 Nov 28 06:43 ssh_host_rsa_key If any file has a mode more permissive than \"0640\", this is a finding. " desc "fix", " Configure the mode of SSH private host key files under \"/etc/ssh\" to \"0640\" with the following command: # chmod 0640 /path/to/file/ssh_host*key " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72257" tag rid: "SV-86881r3_rule" tag stig_id: "RHEL-07-040420" tag fix_id: "F-78611r5_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] key_files = command("find /etc/ssh -xdev -name '*ssh_host*key' -perm /177").stdout.split("\n") if !key_files.nil? and !key_files.empty? key_files.each do |keyfile| describe file(keyfile) do it { should_not be_executable.by('owner') } it { should_not be_readable.by('group') } it { should_not be_writable.by('group') } it { should_not be_executable.by('group') } it { should_not be_readable.by('others') } it { should_not be_writable.by('others') } it { should_not be_executable.by('others') } end end else describe "No files have a more permissive mode." do subject { key_files.nil? or key_files.empty? } it { should eq true } end end end
If the system is not configured to audit certain activities and write them to an audit log, it is more difficult to detect and track system compromises and damages incurred during a system compromise.
Test Results

Status passed
Test Auditd Rules with syscall == "unlinkat" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "unlinkat" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "unlinkat" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "unlinkat" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Result Details

Control V-72207
Title The Red Hat Enterprise Linux operating system must audit all uses of the unlinkat syscall.
Desc If the system is not configured to audit certain activities and write them to an audit log, it is more difficult to detect and track system compromises and damages incurred during a system compromise.
Severity medium
Impact 0.5
Nist Controls AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "unlinkat" syscall occur. Check the file system rules in "/etc/audit/audit.rules" with the following commands: # grep -iw unlinkat /etc/audit/audit.rules -a always,exit -F arch=b32 -S unlinkat -F auid>=1000 -F auid!=4294967295 -k delete -a always,exit -F arch=b64 -S unlinkat -F auid>=1000 -F auid!=4294967295 -k delete If both the "b32" and "b64" audit rules are not defined for the "unlinkat" syscall, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "unlinkat" syscall occur. Add the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S unlinkat -F auid>=1000 -F auid!=4294967295 -k delete -a always,exit -F arch=b64 -S unlinkat -F auid>=1000 -F auid!=4294967295 -k delete The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72207" do title "The Red Hat Enterprise Linux operating system must audit all uses of the unlinkat syscall." desc "If the system is not configured to audit certain activities and write them to an audit log, it is more difficult to detect and track system compromises and damages incurred during a system compromise. " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"unlinkat\" syscall occur. Check the file system rules in \"/etc/audit/audit.rules\" with the following commands: # grep -iw unlinkat /etc/audit/audit.rules -a always,exit -F arch=b32 -S unlinkat -F auid>=1000 -F auid!=4294967295 -k delete -a always,exit -F arch=b64 -S unlinkat -F auid>=1000 -F auid!=4294967295 -k delete If both the \"b32\" and \"b64\" audit rules are not defined for the \"unlinkat\" syscall, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"unlinkat\" syscall occur. Add the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S unlinkat -F auid>=1000 -F auid!=4294967295 -k delete -a always,exit -F arch=b64 -S unlinkat -F auid>=1000 -F auid!=4294967295 -k delete The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000466-GPOS-00210" tag satisfies: ["SRG-OS-000466-GPOS-00210", "SRG-OS-000467-GPOS-00210", "SRG-OS-000468-GPOS-00212", "SRG-OS-000392-GPOS-00172"] tag gid: "V-72207" tag rid: "SV-86831r5_rule" tag stig_id: "RHEL-07-030920" tag fix_id: "F-78561r10_fix" tag cci: ["CCI-000172", "CCI-002884"] tag nist: ["AU-12 c", "MA-4 (1) (a)", "Rev_4"] describe auditd.syscall("unlinkat").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end if os.arch == 'x86_64' describe auditd.syscall("unlinkat").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end end end
The use of separate file systems for different paths can protect the system from failures resulting from a file system becoming full or failing.
Test Results

Status passed
Test ec2-user with mountpoint / is expected not to be empty
Result
Status passed
Test ec2-user with mountpoint / is expected not to match /^\/$/
Result expected "/" not to match /^\/$/ Diff: @@ -1,2 +1,2 @@ -/^\/$/ +"/"
Result Details

Control V-72059
Title The Red Hat Enterprise Linux operating system must be configured so that a separate file system is used for user home directories (such as /home or an equivalent).
Desc The use of separate file systems for different paths can protect the system from failures resulting from a file system becoming full or failing.
Severity low
Impact 0.3
Nist Controls CM-6 b, Rev_4
Check Text Verify that a separate file system/partition has been created for non-privileged local interactive user home directories. Check the home directory assignment for all non-privileged users (those with a UID greater than 1000) on the system with the following command: #cut -d: -f 1,3,6,7 /etc/passwd | egrep ":[1-4][0-9]{3}" | tr ":" "\t" adamsj /home/adamsj /bin/bash jacksonm /home/jacksonm /bin/bash smithj /home/smithj /bin/bash The output of the command will give the directory/partition that contains the home directories for the non-privileged users on the system (in this example, /home) and users' shell. All accounts with a valid shell (such as /bin/bash) are considered interactive users. Check that a file system/partition has been created for the non-privileged interactive users with the following command: Note: The partition of /home is used in the example. # grep /home /etc/fstab UUID=333ada18 /home ext4 noatime,nobarrier,nodev 1 2 If a separate entry for the file system/partition that contains the non-privileged interactive users' home directories does not exist, this is a finding.
Fix Text Migrate the "/home" directory onto a separate file system/partition.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72059" do title "The Red Hat Enterprise Linux operating system must be configured so that a separate file system is used for user home directories (such as /home or an equivalent)." desc "The use of separate file systems for different paths can protect the system from failures resulting from a file system becoming full or failing." desc "rationale", "" desc "check", " Verify that a separate file system/partition has been created for non-privileged local interactive user home directories. Check the home directory assignment for all non-privileged users (those with a UID greater than 1000) on the system with the following command: #cut -d: -f 1,3,6,7 /etc/passwd | egrep \":[1-4][0-9]{3}\" | tr \":\" \"\\t\" adamsj /home/adamsj /bin/bash jacksonm /home/jacksonm /bin/bash smithj /home/smithj /bin/bash The output of the command will give the directory/partition that contains the home directories for the non-privileged users on the system (in this example, /home) and users' shell. All accounts with a valid shell (such as /bin/bash) are considered interactive users. Check that a file system/partition has been created for the non-privileged interactive users with the following command: Note: The partition of /home is used in the example. # grep /home /etc/fstab UUID=333ada18 /home ext4 noatime,nobarrier,nodev 1 2 If a separate entry for the file system/partition that contains the non-privileged interactive users' home directories does not exist, this is a finding. " desc "fix", "Migrate the \"/home\" directory onto a separate file system/partition." impact 0.3 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72059" tag rid: "SV-86683r2_rule" tag stig_id: "RHEL-07-021310" tag fix_id: "F-78411r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] exempt_home_users = input('exempt_home_users') non_interactive_shells = input('non_interactive_shells') ignore_shells = non_interactive_shells.join('|') uid_min = login_defs.read_params['UID_MIN'].to_i uid_min = 1000 if uid_min.nil? # excluding root because its home directory is usually "/root" (mountpoint "/") users.where{ !shell.match(ignore_shells) && (uid >= uid_min)}.entries.each do |user_info| next if exempt_home_users.include?("#{user_info.username}") home_mount = command(%(df #{user_info.home} --output=target | tail -1)).stdout.strip describe user_info.username do context 'with mountpoint' do context home_mount do it { should_not be_empty } it { should_not match(%r(^/$)) } end end end end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with syscall == "fsetxattr" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "fsetxattr" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "fsetxattr" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "fsetxattr" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Result Details

Control V-72113
Title The Red Hat Enterprise Linux operating system must audit all uses of the fsetxattr syscall.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-12 c, Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "fsetxattr" syscall occur. Check the file system rules in "/etc/audit/audit.rules" with the following commands: # grep -iw fsetxattr /etc/audit/audit.rules -a always,exit -F arch=b32 -S fsetxattr -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S fsetxattr -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the "b32" and "b64" audit rules are not defined for the "fsetxattr" syscall, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "fsetxattr" syscall occur. Add or update the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S fsetxattr -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S fsetxattr -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72113" do title "The Red Hat Enterprise Linux operating system must audit all uses of the fsetxattr syscall." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"fsetxattr\" syscall occur. Check the file system rules in \"/etc/audit/audit.rules\" with the following commands: # grep -iw fsetxattr /etc/audit/audit.rules -a always,exit -F arch=b32 -S fsetxattr -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S fsetxattr -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the \"b32\" and \"b64\" audit rules are not defined for the \"fsetxattr\" syscall, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"fsetxattr\" syscall occur. Add or update the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S fsetxattr -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S fsetxattr -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000458-GPOS-00203" tag satisfies: ["SRG-OS-000458-GPOS-00203", "SRG-OS-000392-GPOS-00172", "SRG-OS-000064-GPOS-00033"] tag gid: "V-72113" tag rid: "SV-86737r5_rule" tag stig_id: "RHEL-07-030450" tag fix_id: "F-78465r7_fix" tag cci: ["CCI-000172"] tag nist: ["AU-12 c", "Rev_4"] describe auditd.syscall("fsetxattr").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end if os.arch == 'x86_64' describe auditd.syscall("fsetxattr").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end end end
Responding to broadcast (ICMP) echoes facilitates network mapping and provides a vector for amplification attacks.
Test Results

Status passed
Test Kernel Parameter net.ipv4.icmp_echo_ignore_broadcasts value is expected to eq 1
Result
Result Details

Control V-72287
Title The Red Hat Enterprise Linux operating system must not respond to Internet Protocol version 4 (IPv4) Internet Control Message Protocol (ICMP) echoes sent to a broadcast address.
Desc Responding to broadcast (ICMP) echoes facilitates network mapping and provides a vector for amplification attacks.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the system does not respond to IPv4 ICMP echoes sent to a broadcast address. # grep net.ipv4.icmp_echo_ignore_broadcasts /etc/sysctl.conf /etc/sysctl.d/* If " net.ipv4.icmp_echo_ignore_broadcasts" is not configured in the /etc/sysctl.conf file or in the /etc/sysctl.d/ directory, is commented out, or does not have a value of "1", this is a finding. Check that the operating system implements the "icmp_echo_ignore_broadcasts" variable with the following command: # /sbin/sysctl -a | grep net.ipv4.icmp_echo_ignore_broadcasts net.ipv4.icmp_echo_ignore_broadcasts = 1 If the returned line does not have a value of "1", this is a finding.
Fix Text Set the system to the required kernel parameter by adding the following line to "/etc/sysctl.conf" or a configuration file in the /etc/sysctl.d/ directory (or modify the line to have the required value): net.ipv4.icmp_echo_ignore_broadcasts = 1 Issue the following command to make the changes take effect: # sysctl --system

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72287" do title "The Red Hat Enterprise Linux operating system must not respond to Internet Protocol version 4 (IPv4) Internet Control Message Protocol (ICMP) echoes sent to a broadcast address." desc "Responding to broadcast (ICMP) echoes facilitates network mapping and provides a vector for amplification attacks." desc "rationale", "" desc "check", " Verify the system does not respond to IPv4 ICMP echoes sent to a broadcast address. # grep net.ipv4.icmp_echo_ignore_broadcasts /etc/sysctl.conf /etc/sysctl.d/* If \" net.ipv4.icmp_echo_ignore_broadcasts\" is not configured in the /etc/sysctl.conf file or in the /etc/sysctl.d/ directory, is commented out, or does not have a value of \"1\", this is a finding. Check that the operating system implements the \"icmp_echo_ignore_broadcasts\" variable with the following command: # /sbin/sysctl -a | grep net.ipv4.icmp_echo_ignore_broadcasts net.ipv4.icmp_echo_ignore_broadcasts = 1 If the returned line does not have a value of \"1\", this is a finding. " desc "fix", " Set the system to the required kernel parameter by adding the following line to \"/etc/sysctl.conf\" or a configuration file in the /etc/sysctl.d/ directory (or modify the line to have the required value): net.ipv4.icmp_echo_ignore_broadcasts = 1 Issue the following command to make the changes take effect: # sysctl --system " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72287" tag rid: "SV-86911r2_rule" tag stig_id: "RHEL-07-040630" tag fix_id: "F-78641r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe kernel_parameter('net.ipv4.icmp_echo_ignore_broadcasts') do its('value') { should eq 1 } end end
If local interactive users are not assigned a valid home directory, there is no place for the storage and control of files they should own.
Test Results

Status passed
Test login.defs CREATE_HOME is expected to eq "yes"
Result
Result Details

Control V-72013
Title The Red Hat Enterprise Linux operating system must be configured so that all local interactive user accounts, upon creation, are assigned a home directory.
Desc If local interactive users are not assigned a valid home directory, there is no place for the storage and control of files they should own.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify all local interactive users on the system are assigned a home directory upon creation. Check to see if the system is configured to create home directories for local interactive users with the following command: # grep -i create_home /etc/login.defs CREATE_HOME yes If the value for "CREATE_HOME" parameter is not set to "yes", the line is missing, or the line is commented out, this is a finding.
Fix Text Configure the operating system to assign home directories to all new local interactive users by setting the "CREATE_HOME" parameter in "/etc/login.defs" to "yes" as follows. CREATE_HOME yes

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72013" do title "The Red Hat Enterprise Linux operating system must be configured so that all local interactive user accounts, upon creation, are assigned a home directory." desc "If local interactive users are not assigned a valid home directory, there is no place for the storage and control of files they should own." desc "rationale", "" desc "check", " Verify all local interactive users on the system are assigned a home directory upon creation. Check to see if the system is configured to create home directories for local interactive users with the following command: # grep -i create_home /etc/login.defs CREATE_HOME yes If the value for \"CREATE_HOME\" parameter is not set to \"yes\", the line is missing, or the line is commented out, this is a finding. " desc "fix", " Configure the operating system to assign home directories to all new local interactive users by setting the \"CREATE_HOME\" parameter in \"/etc/login.defs\" to \"yes\" as follows. CREATE_HOME yes " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72013" tag rid: "SV-86637r2_rule" tag stig_id: "RHEL-07-020610" tag fix_id: "F-78365r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe login_defs do its('CREATE_HOME') { should eq 'yes' } end end
Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged password commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Test Results

Status passed
Test Auditd Rules with file == "/usr/bin/gpasswd" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/usr/bin/gpasswd" action is expected not to include "never"
Result
Status passed
Test ["x"] is expected to include "x"
Result
Result Details

Control V-72153
Title The Red Hat Enterprise Linux operating system must audit all uses of the gpasswd command.
Desc Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged password commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Severity medium
Impact 0.5
Nist Controls AU-3 (1), AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "gpasswd" command occur. Check the file system rule in "/etc/audit/audit.rules" with the following command: # grep -i /usr/bin/gpasswd /etc/audit/audit.rules -a always,exit -F path=/usr/bin/gpasswd -F auid>=1000 -F auid!=4294967295 -k privileged-passwd If the command does not return any output, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "gpasswd" command occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules": -a always,exit -F path=/usr/bin/gpasswd -F auid>=1000 -F auid!=4294967295 -k privileged-passwd The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72153" do title "The Red Hat Enterprise Linux operating system must audit all uses of the gpasswd command." desc "Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged password commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise. " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"gpasswd\" command occur. Check the file system rule in \"/etc/audit/audit.rules\" with the following command: # grep -i /usr/bin/gpasswd /etc/audit/audit.rules -a always,exit -F path=/usr/bin/gpasswd -F auid>=1000 -F auid!=4294967295 -k privileged-passwd If the command does not return any output, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"gpasswd\" command occur. Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F path=/usr/bin/gpasswd -F auid>=1000 -F auid!=4294967295 -k privileged-passwd The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000042-GPOS-00020" tag satisfies: ["SRG-OS-000042-GPOS-00020", "SRG-OS-000392-GPOS-00172", "SRG-OS-000471-GPOS-00215"] tag gid: "V-72153" tag rid: "SV-86777r5_rule" tag stig_id: "RHEL-07-030650" tag fix_id: "F-78505r5_fix" tag cci: ["CCI-000135", "CCI-000172", "CCI-002884"] tag nist: ["AU-3 (1)", "AU-12 c", "MA-4 (1) (a)", "Rev_4"] audit_file = '/usr/bin/gpasswd' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'x' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. If the information system or application allows the user to consecutively reuse their password when that password has exceeded its defined lifetime, the end result is a password that is not changed per policy requirements.
Test Results

Status passed
Test PAM Config[/etc/pam.d/system-auth] lines is expected to include password (required|requisite|sufficient) pam_(unix|pwhistory).so, any with arg remember >= 5
Result
Result Details

Control V-71933
Title The Red Hat Enterprise Linux operating system must be configured so that passwords are prohibited from reuse for a minimum of five generations.
Desc Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. If the information system or application allows the user to consecutively reuse their password when that password has exceeded its defined lifetime, the end result is a password that is not changed per policy requirements.
Severity medium
Impact 0.5
Nist Controls IA-5 (1) (e), Rev_4
Check Text Verify the operating system prohibits password reuse for a minimum of five generations. Check for the value of the "remember" argument in "/etc/pam.d/system-auth" and "/etc/pam.d/password-auth" with the following command: # grep -i remember /etc/pam.d/system-auth /etc/pam.d/password-auth password requisite pam_pwhistory.so use_authtok remember=5 retry=3 If the line containing the "pam_pwhistory.so" line does not have the "remember" module argument set, is commented out, or the value of the "remember" module argument is set to less than "5", this is a finding.
Fix Text Configure the operating system to prohibit password reuse for a minimum of five generations. Add the following line in "/etc/pam.d/system-auth" and "/etc/pam.d/password-auth" (or modify the line to have the required value): password requisite pam_pwhistory.so use_authtok remember=5 retry=3 Note: Manual changes to the listed files may be overwritten by the "authconfig" program. The "authconfig" program should not be used to update the configurations listed in this requirement.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71933" do title "The Red Hat Enterprise Linux operating system must be configured so that passwords are prohibited from reuse for a minimum of five generations." desc "Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. If the information system or application allows the user to consecutively reuse their password when that password has exceeded its defined lifetime, the end result is a password that is not changed per policy requirements." desc "rationale", "" desc "check", " Verify the operating system prohibits password reuse for a minimum of five generations. Check for the value of the \"remember\" argument in \"/etc/pam.d/system-auth\" and \"/etc/pam.d/password-auth\" with the following command: # grep -i remember /etc/pam.d/system-auth /etc/pam.d/password-auth password requisite pam_pwhistory.so use_authtok remember=5 retry=3 If the line containing the \"pam_pwhistory.so\" line does not have the \"remember\" module argument set, is commented out, or the value of the \"remember\" module argument is set to less than \"5\", this is a finding. " desc "fix", " Configure the operating system to prohibit password reuse for a minimum of five generations. Add the following line in \"/etc/pam.d/system-auth\" and \"/etc/pam.d/password-auth\" (or modify the line to have the required value): password requisite pam_pwhistory.so use_authtok remember=5 retry=3 Note: Manual changes to the listed files may be overwritten by the \"authconfig\" program. The \"authconfig\" program should not be used to update the configurations listed in this requirement. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000077-GPOS-00045" tag gid: "V-71933" tag rid: "SV-86557r3_rule" tag stig_id: "RHEL-07-010270" tag fix_id: "F-78285r3_fix" tag cci: ["CCI-000200"] tag nist: ["IA-5 (1) (e)", "Rev_4"] min_reuse_generations = input('min_reuse_generations') describe pam("/etc/pam.d/system-auth") do its('lines') { should match_pam_rule('password (required|requisite|sufficient) pam_(unix|pwhistory).so').any_with_integer_arg('remember', '>=', min_reuse_generations) } end end
The "nodev" mount option causes the system to not interpret character or block special devices. Executing character or block special devices from untrusted file systems increases the opportunity for unprivileged users to attain unauthorized administrative access.
Test Results

Status passed
Test Mount /dev/shm options is expected to include "nodev"
Result
Result Details

Control V-81009
Title The Red Hat Enterprise Linux operating system must mount /dev/shm with the nodev option.
Desc The "nodev" mount option causes the system to not interpret character or block special devices. Executing character or block special devices from untrusted file systems increases the opportunity for unprivileged users to attain unauthorized administrative access.
Severity low
Impact 0.3
Nist Controls CM-7 (2), Rev_4
Check Text Verify that the "nodev" option is configured for /dev/shm: # cat /etc/fstab | grep /dev/shm tmpfs /dev/shm tmpfs defaults,nodev,nosuid,noexec 0 0 If any results are returned and the "nodev" option is not listed, this is a finding. Verify "/dev/shm" is mounted with the "nodev" option: # mount | grep "/dev/shm" | grep nodev If no results are returned, this is a finding.
Fix Text Configure the system so that /dev/shm is mounted with the "nodev" option.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-81009" do title "The Red Hat Enterprise Linux operating system must mount /dev/shm with the nodev option." desc "The \"nodev\" mount option causes the system to not interpret character or block special devices. Executing character or block special devices from untrusted file systems increases the opportunity for unprivileged users to attain unauthorized administrative access." desc "rationale", "" desc "check", " Verify that the \"nodev\" option is configured for /dev/shm: # cat /etc/fstab | grep /dev/shm tmpfs /dev/shm tmpfs defaults,nodev,nosuid,noexec 0 0 If any results are returned and the \"nodev\" option is not listed, this is a finding. Verify \"/dev/shm\" is mounted with the \"nodev\" option: # mount | grep \"/dev/shm\" | grep nodev If no results are returned, this is a finding. " desc "fix", "Configure the system so that /dev/shm is mounted with the \"nodev\" option." impact 0.3 tag severity: nil tag gtitle: "SRG-OS-000368-GPOS-00154" tag gid: "V-81009" tag rid: "SV-95721r2_rule" tag stig_id: "RHEL-07-021022" tag fix_id: "F-87843r2_fix" tag cci: ["CCI-001764"] tag nist: ["CM-7 (2)", "Rev_4"] describe mount('/dev/shm') do its('options') { should include 'nodev' } end end
To assure accountability and prevent unauthenticated access, organizational users must be identified and authenticated to prevent potential misuse and compromise of the system. Organizational users include organizational employees or individuals the organization deems to have equivalent status of employees (e.g., contractors). Organizational users (and processes acting on behalf of users) must be uniquely identified and authenticated to all accesses, except for the following: 1) Accesses explicitly identified and documented by the organization. Organizations document specific user actions that can be performed on the information system without identification or authentication; and 2) Accesses that occur through authorized use of group authenticators without individual authentication. Organizations may require unique identification of individuals in group accounts (e.g., shared privilege accounts) or for detailed accountability of individual activity.
Test Results

Status passed
Test Command: `authconfig --test | grep -i smartcard` stdout is expected to match /use\sonly\ssmartcard\sfor\slogin\sis\senabled/
Result expected "SSSD smartcard support is disabled\n use only smartcard for login is disabled\n smartcard module = \"\"\n smartcard removal action = \"\"\n" to match /use\sonly\ssmartcard\sfor\slogin\sis\senabled/ Diff: @@ -1,2 +1,5 @@ -/use\sonly\ssmartcard\sfor\slogin\sis\senabled/ +SSSD smartcard support is disabled + use only smartcard for login is disabled + smartcard module = "" + smartcard removal action = ""
Status passed
Test Command: `authconfig --test | grep -i smartcard` stdout is expected to match /smartcard\smodule\s=\s".+"/
Result expected "SSSD smartcard support is disabled\n use only smartcard for login is disabled\n smartcard module = \"\"\n smartcard removal action = \"\"\n" to match /smartcard\smodule\s=\s".+"/ Diff: @@ -1,2 +1,5 @@ -/smartcard\smodule\s=\s".+"/ +SSSD smartcard support is disabled + use only smartcard for login is disabled + smartcard module = "" + smartcard removal action = ""
Status passed
Test Command: `authconfig --test | grep -i smartcard` stdout is expected to match /smartcard\sremoval\saction\s=\s".+"/
Result expected "SSSD smartcard support is disabled\n use only smartcard for login is disabled\n smartcard module = \"\"\n smartcard removal action = \"\"\n" to match /smartcard\sremoval\saction\s=\s".+"/ Diff: @@ -1,2 +1,5 @@ -/smartcard\sremoval\saction\s=\s".+"/ +SSSD smartcard support is disabled + use only smartcard for login is disabled + smartcard module = "" + smartcard removal action = ""
Result Details

Control V-71965
Title The Red Hat Enterprise Linux operating system must uniquely identify and must authenticate organizational users (or processes acting on behalf of organizational users) using multifactor authentication.
Desc To assure accountability and prevent unauthenticated access, organizational users must be identified and authenticated to prevent potential misuse and compromise of the system. Organizational users include organizational employees or individuals the organization deems to have equivalent status of employees (e.g., contractors). Organizational users (and processes acting on behalf of users) must be uniquely identified and authenticated to all accesses, except for the following: 1) Accesses explicitly identified and documented by the organization. Organizations document specific user actions that can be performed on the information system without identification or authentication; and 2) Accesses that occur through authorized use of group authenticators without individual authentication. Organizations may require unique identification of individuals in group accounts (e.g., shared privilege accounts) or for detailed accountability of individual activity.
Severity medium
Impact 0.5
Nist Controls IA-2 (2), Rev_4
Check Text Verify the operating system requires multifactor authentication to uniquely identify organizational users using multifactor authentication. Check to see if smartcard authentication is enforced on the system: # authconfig --test | grep "pam_pkcs11 is enabled" If no results are returned, this is a finding. # authconfig --test | grep "smartcard removal action" If "smartcard removal action" is blank, this is a finding. # authconfig --test | grep "smartcard module" If "smartcard module" is blank, this is a finding.
Fix Text Configure the operating system to require individuals to be authenticated with a multifactor authenticator. Enable smartcard logons with the following commands: # authconfig --enablesmartcard --smartcardaction=0 --update # authconfig --enablerequiresmartcard -update Modify the "/etc/pam_pkcs11/pkcs11_eventmgr.conf" file to uncomment the following line: #/usr/X11R6/bin/xscreensaver-command -lock Modify the "/etc/pam_pkcs11/pam_pkcs11.conf" file to use the cackey module if required.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71965" do title "The Red Hat Enterprise Linux operating system must uniquely identify and must authenticate organizational users (or processes acting on behalf of organizational users) using multifactor authentication." desc "To assure accountability and prevent unauthenticated access, organizational users must be identified and authenticated to prevent potential misuse and compromise of the system. Organizational users include organizational employees or individuals the organization deems to have equivalent status of employees (e.g., contractors). Organizational users (and processes acting on behalf of users) must be uniquely identified and authenticated to all accesses, except for the following: 1) Accesses explicitly identified and documented by the organization. Organizations document specific user actions that can be performed on the information system without identification or authentication; and 2) Accesses that occur through authorized use of group authenticators without individual authentication. Organizations may require unique identification of individuals in group accounts (e.g., shared privilege accounts) or for detailed accountability of individual activity. " desc "rationale", "" desc "check", " Verify the operating system requires multifactor authentication to uniquely identify organizational users using multifactor authentication. Check to see if smartcard authentication is enforced on the system: # authconfig --test | grep \"pam_pkcs11 is enabled\" If no results are returned, this is a finding. # authconfig --test | grep \"smartcard removal action\" If \"smartcard removal action\" is blank, this is a finding. # authconfig --test | grep \"smartcard module\" If \"smartcard module\" is blank, this is a finding. " desc "fix", " Configure the operating system to require individuals to be authenticated with a multifactor authenticator. Enable smartcard logons with the following commands: # authconfig --enablesmartcard --smartcardaction=0 --update # authconfig --enablerequiresmartcard -update Modify the \"/etc/pam_pkcs11/pkcs11_eventmgr.conf\" file to uncomment the following line: #/usr/X11R6/bin/xscreensaver-command -lock Modify the \"/etc/pam_pkcs11/pam_pkcs11.conf\" file to use the cackey module if required. " tag severity: nil tag gtitle: "SRG-OS-000104-GPOS-00051" tag satisfies: ["SRG-OS-000104-GPOS-00051", "SRG-OS-000106-GPOS-00053", "SRG-OS-000107-GPOS-00054", "SRG-OS-000109-GPOS-00056", "SRG-OS-000108-GPOS-00055", "SRG-OS-000108-GPOS-00057", "SRG-OS-000108-GPOS-00058"] tag gid: "V-71965" tag rid: "SV-86589r2_rule" tag stig_id: "RHEL-07-010500" tag fix_id: "F-78317r3_fix" tag cci: ["CCI-000766"] tag nist: ["IA-2 (2)", "Rev_4"] smart_card_status = input('smart_card_status') if smart_card_status.eql?('enabled') impact 0.5 describe command("authconfig --test | grep -i smartcard") do its('stdout') { should match %r{use\sonly\ssmartcard\sfor\slogin\sis\s#{smart_card_status}} } its('stdout') { should match %r{smartcard\smodule\s=\s".+"} } its('stdout') { should match %r{smartcard\sremoval\saction\s=\s".+"} } end else impact 0.0 describe "The system is not smartcard enabled" do skip "The system is not using Smartcards / PIVs to fulfil the MFA requirement, this control is Not Applicable." end end end
Whether active or not, default Simple Network Management Protocol (SNMP) community strings must be changed to maintain security. If the service is running with the default authenticators, anyone can gather data about the system and the network and use the information to potentially compromise the integrity of the system or network(s). It is highly recommended that SNMP version 3 user authentication and message encryption be used in place of the version 2 community strings.
Test Results

Status skipped
Test The `snmpd.conf` does not exist
Result
Result Details

Control V-72313
Title SNMP community strings on the Red Hat Enterprise Linux operating system must be changed from the default.
Desc Whether active or not, default Simple Network Management Protocol (SNMP) community strings must be changed to maintain security. If the service is running with the default authenticators, anyone can gather data about the system and the network and use the information to potentially compromise the integrity of the system or network(s). It is highly recommended that SNMP version 3 user authentication and message encryption be used in place of the version 2 community strings.
Severity none
Nist Controls CM-6 b, Rev_4
Check Text Verify that a system using SNMP is not using default community strings. Check to see if the "/etc/snmp/snmpd.conf" file exists with the following command: # ls -al /etc/snmp/snmpd.conf -rw------- 1 root root 52640 Mar 12 11:08 snmpd.conf If the file does not exist, this is Not Applicable. If the file does exist, check for the default community strings with the following commands: # grep public /etc/snmp/snmpd.conf # grep private /etc/snmp/snmpd.conf If either of these commands returns any output, this is a finding.
Fix Text If the "/etc/snmp/snmpd.conf" file exists, modify any lines that contain a community string value of "public" or "private" to another string value.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72313" do title "SNMP community strings on the Red Hat Enterprise Linux operating system must be changed from the default." desc "Whether active or not, default Simple Network Management Protocol (SNMP) community strings must be changed to maintain security. If the service is running with the default authenticators, anyone can gather data about the system and the network and use the information to potentially compromise the integrity of the system or network(s). It is highly recommended that SNMP version 3 user authentication and message encryption be used in place of the version 2 community strings." desc "rationale", "" desc "check", " Verify that a system using SNMP is not using default community strings. Check to see if the \"/etc/snmp/snmpd.conf\" file exists with the following command: # ls -al /etc/snmp/snmpd.conf -rw------- 1 root root 52640 Mar 12 11:08 snmpd.conf If the file does not exist, this is Not Applicable. If the file does exist, check for the default community strings with the following commands: # grep public /etc/snmp/snmpd.conf # grep private /etc/snmp/snmpd.conf If either of these commands returns any output, this is a finding. " desc "fix", "If the \"/etc/snmp/snmpd.conf\" file exists, modify any lines that contain a community string value of \"public\" or \"private\" to another string value." tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72313" tag rid: "SV-86937r2_rule" tag stig_id: "RHEL-07-040800" tag fix_id: "F-78667r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] if file('/etc/snmp/snmpd.conf').exist? impact 0.7 processed = [] to_process = ['/etc/snmp/snmpd.conf'] while !to_process.empty? in_process = to_process.pop next if processed.include? in_process processed.push in_process if file(in_process).directory? to_process.concat( command("find #{in_process} -maxdepth 1 -mindepth 1 -name '*.conf'"). stdout.strip.split("\n"). select { |f| file(f).file? } ) elsif file(in_process).file? to_process.concat( command("grep -E '^\\s*includeFile\\s+' #{in_process} | sed 's/^[[:space:]]*includeFile[[:space:]]*//g'"). stdout.strip.split(%r{\n+}). map { |f| f.start_with?('/') ? f : File.join(File.dirname(in_process), f) }. select { |f| file(f).file? } ) to_process.concat( command("grep -E '^\\s*includeDir\\s+' #{in_process} | sed 's/^[[:space:]]*includeDir[[:space:]]*//g'"). stdout.strip.split(%r{\n+}). map { |f| f.start_with?('/') ? f : File.join('/', f) }. # relative dirs are treated as absolute select { |f| file(f).directory? } ) end end config_files = processed.select { |f| file(f).file? } config_files.each do |config| describe file(config) do its('content') { should_not match %r{^[^#]*(public|private)} } end end else impact 0.0 describe "The `snmpd.conf` does not exist" do skip "The snmpd.conf file does not exist, this control is Not Applicable" end end end
Local initialization files are used to configure the user's shell environment upon logon. Malicious modification of these files could compromise accounts upon logon.
Test Results

Status passed
Test Files and Directories not owned by the user or root of the parent home directory is expected to be empty
Result
Result Details

Control V-72029
Title The Red Hat Enterprise Linux operating system must be configured so that all local initialization files for interactive users are owned by the home directory user or root.
Desc Local initialization files are used to configure the user's shell environment upon logon. Malicious modification of these files could compromise accounts upon logon.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the local initialization files of all local interactive users are group-owned by that user's primary Group Identifier (GID). Check the home directory assignment for all non-privileged users on the system with the following command: Note: The example will be for the smithj user, who has a home directory of "/home/smithj" and a primary group of "users". # cut -d: -f 1,4,6 /etc/passwd | egrep ":[1-4][0-9]{3}" smithj:1000:/home/smithj # grep 1000 /etc/group users:x:1000:smithj,jonesj,jacksons Note: This may miss interactive users that have been assigned a privileged User Identifier (UID). Evidence of interactive use may be obtained from a number of log files containing system logon information. Check the group owner of all local interactive user's initialization files with the following command: # ls -al /home/smithj/.[^.]* | more -rwxr-xr-x 1 smithj users 896 Mar 10 2011 .profile -rwxr-xr-x 1 smithj users 497 Jan 6 2007 .login -rwxr-xr-x 1 smithj users 886 Jan 6 2007 .something If all local interactive user's initialization files are not group-owned by that user's primary GID, this is a finding.
Fix Text Set the owner of the local initialization files for interactive users to either the directory owner or root with the following command: Note: The example will be for the smithj user, who has a home directory of "/home/smithj". # chown smithj /home/smithj/.[^.]*

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72029" do title "The Red Hat Enterprise Linux operating system must be configured so that all local initialization files for interactive users are owned by the home directory user or root." desc "Local initialization files are used to configure the user's shell environment upon logon. Malicious modification of these files could compromise accounts upon logon." desc "rationale", "" desc "check", " Verify the local initialization files of all local interactive users are group-owned by that user's primary Group Identifier (GID). Check the home directory assignment for all non-privileged users on the system with the following command: Note: The example will be for the smithj user, who has a home directory of \"/home/smithj\" and a primary group of \"users\". # cut -d: -f 1,4,6 /etc/passwd | egrep \":[1-4][0-9]{3}\" smithj:1000:/home/smithj # grep 1000 /etc/group users:x:1000:smithj,jonesj,jacksons Note: This may miss interactive users that have been assigned a privileged User Identifier (UID). Evidence of interactive use may be obtained from a number of log files containing system logon information. Check the group owner of all local interactive user's initialization files with the following command: # ls -al /home/smithj/.[^.]* | more -rwxr-xr-x 1 smithj users 896 Mar 10 2011 .profile -rwxr-xr-x 1 smithj users 497 Jan 6 2007 .login -rwxr-xr-x 1 smithj users 886 Jan 6 2007 .something If all local interactive user's initialization files are not group-owned by that user's primary GID, this is a finding. " desc "fix", " Set the owner of the local initialization files for interactive users to either the directory owner or root with the following command: Note: The example will be for the smithj user, who has a home directory of \"/home/smithj\". # chown smithj /home/smithj/.[^.]* " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72029" tag rid: "SV-86653r3_rule" tag stig_id: "RHEL-07-020690" tag fix_id: "F-78381r4_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] exempt_home_users = input('exempt_home_users') non_interactive_shells = input('non_interactive_shells') ignore_shells = non_interactive_shells.join('|') findings = Set[] users.where{ !shell.match(ignore_shells) && (uid >= 1000 || uid == 0)}.entries.each do |user_info| next if exempt_home_users.include?("#{user_info.username}") findings = findings + command("find #{user_info.home} -name '.*' -not -user #{user_info.username} -a -not -user root").stdout.split("\n") end describe "Files and Directories not owned by the user or root of the parent home directory" do subject { findings.to_a } it { should be_empty } end end
Using an authentication device, such as a CAC or token that is separate from the information system, ensures that even if the information system is compromised, that compromise will not affect credentials stored on the authentication device. Multifactor solutions that require devices separate from information systems gaining access include, for example, hardware tokens providing time-based or challenge-response authenticators and smart cards such as the U.S. Government Personal Identity Verification card and the DoD Common Access Card. A privileged account is defined as an information system account with authorizations of a privileged user. Remote access is access to DoD nonpublic information systems by an authorized user (or an information system) communicating through an external, non-organization-controlled network. Remote access methods include, for example, dial-up, broadband, and wireless. This requirement only applies to components where this is specific to the function of the device or has the concept of an organizational user (e.g., VPN, proxy capability). This does not apply to authentication for the purpose of configuring the device itself (management).
Test Results

Status passed
Test The package is expected to be installed
Result
Status passed
Test The package is expected to be installed
Result expected that `System Package nss-pam-ldapd` is installed
Status passed
Test The package is expected to be installed
Result expected that `System Package esc` is installed
Status passed
Test The package is expected to be installed
Result expected that `System Package pam_pkcs11` is installed
Status passed
Test The package is expected to be installed
Result expected that `System Package pam_krb5` is installed
Status passed
Test The package is expected to be installed
Result expected that `System Package opensc` is installed
Status passed
Test The package is expected to be installed
Result expected that `System Package pcsc-lite-ccid` is installed
Status passed
Test The package is expected to be installed
Result expected that `System Package gdm` is installed
Status passed
Test The package is expected to be installed
Result
Status passed
Test The package is expected to be installed
Result expected that `System Package authconfig-gtk` is installed
Status passed
Test The package is expected to be installed
Result
Status passed
Test The package is expected to be installed
Result expected that `System Package krb5-workstation` is installed
Status passed
Test The package is expected to be installed
Result expected that `System Package krb5-pkinit` is installed
Status passed
Test The package is expected to be installed
Result expected that `System Package pcsc-lite` is installed
Status passed
Test The package is expected to be installed
Result expected that `System Package pcsc-lite-libs` is installed
Result Details

Control V-72417
Title The Red Hat Enterprise Linux operating system must have the required packages for multifactor authentication installed.
Desc Using an authentication device, such as a CAC or token that is separate from the information system, ensures that even if the information system is compromised, that compromise will not affect credentials stored on the authentication device. Multifactor solutions that require devices separate from information systems gaining access include, for example, hardware tokens providing time-based or challenge-response authenticators and smart cards such as the U.S. Government Personal Identity Verification card and the DoD Common Access Card. A privileged account is defined as an information system account with authorizations of a privileged user. Remote access is access to DoD nonpublic information systems by an authorized user (or an information system) communicating through an external, non-organization-controlled network. Remote access methods include, for example, dial-up, broadband, and wireless. This requirement only applies to components where this is specific to the function of the device or has the concept of an organizational user (e.g., VPN, proxy capability). This does not apply to authentication for the purpose of configuring the device itself (management).
Severity medium
Impact 0.5
Nist Controls IA-2 (11), IA-2 (12), IA-2 (12), Rev_4
Check Text Verify the operating system has the packages required for multifactor authentication installed. Check for the presence of the packages required to support multifactor authentication with the following commands: # yum list installed esc esc-1.1.0-26.el7.noarch.rpm # yum list installed pam_pkcs11 pam_pkcs11-0.6.2-14.el7.noarch.rpm If the "esc" and "pam_pkcs11" packages are not installed, this is a finding.
Fix Text Configure the operating system to implement multifactor authentication by installing the required packages. Install the "esc" and "pam_pkcs11" packages on the system with the following command: # yum install esc pam_pkcs11

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72417" do title "The Red Hat Enterprise Linux operating system must have the required packages for multifactor authentication installed." desc "Using an authentication device, such as a CAC or token that is separate from the information system, ensures that even if the information system is compromised, that compromise will not affect credentials stored on the authentication device. Multifactor solutions that require devices separate from information systems gaining access include, for example, hardware tokens providing time-based or challenge-response authenticators and smart cards such as the U.S. Government Personal Identity Verification card and the DoD Common Access Card. A privileged account is defined as an information system account with authorizations of a privileged user. Remote access is access to DoD nonpublic information systems by an authorized user (or an information system) communicating through an external, non-organization-controlled network. Remote access methods include, for example, dial-up, broadband, and wireless. This requirement only applies to components where this is specific to the function of the device or has the concept of an organizational user (e.g., VPN, proxy capability). This does not apply to authentication for the purpose of configuring the device itself (management)." desc "check", " Verify the operating system has the packages required for multifactor authentication installed. Check for the presence of the packages required to support multifactor authentication with the following commands: # yum list installed esc esc-1.1.0-26.el7.noarch.rpm # yum list installed pam_pkcs11 pam_pkcs11-0.6.2-14.el7.noarch.rpm If the \"esc\" and \"pam_pkcs11\" packages are not installed, this is a finding." desc "fix", " Configure the operating system to implement multifactor authentication by installing the required packages. Install the \"esc\" and \"pam_pkcs11\" packages on the system with the following command: # yum install esc pam_pkcs11" tag severity: nil tag gtitle: "SRG-OS-000375-GPOS-00160" tag satisfies: ["SRG-OS-000375-GPOS-00160", "SRG-OS-000375-GPOS-00161", "SRG-OS-000375-GPOS-00162"] tag gid: "V-72417" tag rid: "SV-87041r4_rule" tag stig_id: "RHEL-07-041001" tag fix_id: "F-78769r4_fix" tag cci: ["CCI-001948", "CCI-001953", "CCI-001954"] tag nist: ["IA-2 (11)", "IA-2 (12)", "IA-2 (12)", "Rev_4"] mfa_pkg_list = input('mfa_pkg_list') smart_card_status = input('smart_card_status') if smart_card_status.eql?('disabled') impact 0.0 describe "The system is not smartcard enabled thus this control is Not Applicable" do skip "The system is not using Smartcards / PIVs to fulfil the MFA requirement, this control is Not Applicable." end elsif mfa_pkg_list.empty? describe "The required Smartcard packages have not beed defined, plese define them in your `inputs`." do subjec { mfa_pkg_list } it { should_not be_empty } end else mfa_pkg_list.each do |pkg| describe "The package" do subject { package("#{pkg}") } it { should be_installed } end end end end
The use of wireless networking can introduce many different attack vectors into the organization's network. Common attack vectors such as malicious association and ad hoc networks will allow an attacker to spoof a wireless access point (AP), allowing validated systems to connect to the malicious AP and enabling the attacker to monitor and record network traffic. These malicious APs can also serve to create a man-in-the-middle attack or be used to create a denial of service to valid network resources.
Test Results

Status passed
Test Command: `nmcli device` stdout.strip is expected not to match /wifi connected/
Result
Result Details

Control V-73177
Title The Red Hat Enterprise Linux operating system must be configured so that all wireless network adapters are disabled.
Desc The use of wireless networking can introduce many different attack vectors into the organization's network. Common attack vectors such as malicious association and ad hoc networks will allow an attacker to spoof a wireless access point (AP), allowing validated systems to connect to the malicious AP and enabling the attacker to monitor and record network traffic. These malicious APs can also serve to create a man-in-the-middle attack or be used to create a denial of service to valid network resources.
Severity medium
Impact 0.5
Nist Controls AC-18 (1), AC-18 (1), SC-8, Rev_4
Check Text Verify that there are no wireless interfaces configured on the system. This is N/A for systems that do not have wireless network adapters. Check for the presence of active wireless interfaces with the following command: # nmcli device DEVICE TYPE STATE eth0 ethernet connected wlp3s0 wifi disconnected lo loopback unmanaged If a wireless interface is configured and its use on the system is not documented with the Information System Security Officer (ISSO), this is a finding.
Fix Text Configure the system to disable all wireless network interfaces with the following command: #nmcli radio wifi off

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-73177" do title "The Red Hat Enterprise Linux operating system must be configured so that all wireless network adapters are disabled." desc "The use of wireless networking can introduce many different attack vectors into the organization's network. Common attack vectors such as malicious association and ad hoc networks will allow an attacker to spoof a wireless access point (AP), allowing validated systems to connect to the malicious AP and enabling the attacker to monitor and record network traffic. These malicious APs can also serve to create a man-in-the-middle attack or be used to create a denial of service to valid network resources." desc "rationale", "" desc "check", " Verify that there are no wireless interfaces configured on the system. This is N/A for systems that do not have wireless network adapters. Check for the presence of active wireless interfaces with the following command: # nmcli device DEVICE TYPE STATE eth0 ethernet connected wlp3s0 wifi disconnected lo loopback unmanaged If a wireless interface is configured and its use on the system is not documented with the Information System Security Officer (ISSO), this is a finding. " desc "fix", " Configure the system to disable all wireless network interfaces with the following command: #nmcli radio wifi off " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000424-GPOS-00188" tag gid: "V-73177" tag rid: "SV-87829r2_rule" tag stig_id: "RHEL-07-041010" tag fix_id: "F-79623r1_fix" tag cci: ["CCI-001443", "CCI-001444", "CCI-002418"] tag nist: ["AC-18 (1)", "AC-18 (1)", "SC-8", "Rev_4"] describe command('nmcli device') do its('stdout.strip') { should_not match %r{wifi connected} } end end
If a local interactive user files have excessive permissions, unintended users may be able to access or modify them.
Test Results

Status passed
Test Home directories with excessive permissions is expected to be empty
Result
Result Details

Control V-72027
Title The Red Hat Enterprise Linux operating system must be configured so that all files and directories contained in local interactive user home directories have a mode of 0750 or less permissive.
Desc If a local interactive user files have excessive permissions, unintended users may be able to access or modify them.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify all files and directories contained in a local interactive user home directory, excluding local initialization files, have a mode of "0750". Check the mode of all non-initialization files in a local interactive user home directory with the following command: Files that begin with a "." are excluded from this requirement. Note: The example will be for the user "smithj", who has a home directory of "/home/smithj". # ls -lLR /home/smithj -rwxr-x--- 1 smithj smithj 18 Mar 5 17:06 file1 -rwxr----- 1 smithj smithj 193 Mar 5 17:06 file2 -rw-r-x--- 1 smithj smithj 231 Mar 5 17:06 file3 If any files are found with a mode more permissive than "0750", this is a finding.
Fix Text Set the mode on files and directories in the local interactive user home directory with the following command: Note: The example will be for the user smithj, who has a home directory of "/home/smithj" and is a member of the users group. # chmod 0750 /home/smithj/<file>

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72027" do title "The Red Hat Enterprise Linux operating system must be configured so that all files and directories contained in local interactive user home directories have a mode of 0750 or less permissive." desc "If a local interactive user files have excessive permissions, unintended users may be able to access or modify them." desc "rationale", "" desc "check", " Verify all files and directories contained in a local interactive user home directory, excluding local initialization files, have a mode of \"0750\". Check the mode of all non-initialization files in a local interactive user home directory with the following command: Files that begin with a \".\" are excluded from this requirement. Note: The example will be for the user \"smithj\", who has a home directory of \"/home/smithj\". # ls -lLR /home/smithj -rwxr-x--- 1 smithj smithj 18 Mar 5 17:06 file1 -rwxr----- 1 smithj smithj 193 Mar 5 17:06 file2 -rw-r-x--- 1 smithj smithj 231 Mar 5 17:06 file3 If any files are found with a mode more permissive than \"0750\", this is a finding. " desc "fix", " Set the mode on files and directories in the local interactive user home directory with the following command: Note: The example will be for the user smithj, who has a home directory of \"/home/smithj\" and is a member of the users group. # chmod 0750 /home/smithj/<file> " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72027" tag rid: "SV-86651r2_rule" tag stig_id: "RHEL-07-020680" tag fix_id: "F-78379r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] exempt_home_users = input('exempt_home_users') non_interactive_shells = input('non_interactive_shells') ignore_shells = non_interactive_shells.join('|') findings = Set[] users.where{ !shell.match(ignore_shells) && (uid >= 1000 || uid == 0)}.entries.each do |user_info| next if exempt_home_users.include?("#{user_info.username}") findings = findings + command("find #{user_info.home} -xdev ! -name '.*' -perm /027 ! -type l").stdout.split("\n") end describe "Home directories with excessive permissions" do subject { findings.to_a } it { should be_empty } end end
Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged password commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Test Results

Status passed
Test Auditd Rules with file == "/usr/bin/chage" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/usr/bin/chage" action is expected not to include "never"
Result
Status passed
Test ["x"] is expected to include "x"
Result
Result Details

Control V-72155
Title The Red Hat Enterprise Linux operating system must audit all uses of the chage command.
Desc Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged password commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Severity medium
Impact 0.5
Nist Controls AU-3 (1), AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "chage" command occur. Check the file system rule in "/etc/audit/audit.rules" with the following command: # grep -i /usr/bin/chage /etc/audit/audit.rules -a always,exit -F path=/usr/bin/chage -F auid>=1000 -F auid!=4294967295 -k privileged-passwd If the command does not return any output, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "chage" command occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules": -a always,exit -F path=/usr/bin/chage -F auid>=1000 -F auid!=4294967295 -k privileged-passwd The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72155" do title "The Red Hat Enterprise Linux operating system must audit all uses of the chage command." desc "Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged password commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise. " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"chage\" command occur. Check the file system rule in \"/etc/audit/audit.rules\" with the following command: # grep -i /usr/bin/chage /etc/audit/audit.rules -a always,exit -F path=/usr/bin/chage -F auid>=1000 -F auid!=4294967295 -k privileged-passwd If the command does not return any output, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"chage\" command occur. Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F path=/usr/bin/chage -F auid>=1000 -F auid!=4294967295 -k privileged-passwd The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000042-GPOS-00020" tag satisfies: ["SRG-OS-000042-GPOS-00020", "SRG-OS-000392-GPOS-00172", "SRG-OS-000471-GPOS-00215"] tag gid: "V-72155" tag rid: "SV-86779r5_rule" tag stig_id: "RHEL-07-030660" tag fix_id: "F-78507r5_fix" tag cci: ["CCI-000135", "CCI-000172", "CCI-002884"] tag nist: ["AU-3 (1)", "AU-12 c", "MA-4 (1) (a)", "Rev_4"] audit_file = '/usr/bin/chage' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'x' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised.
Test Results

Status passed
Test Parse Config File /etc/security/pwquality.conf lcredit.to_i is expected to cmp < 0
Result
Result Details

Control V-71905
Title The Red Hat Enterprise Linux operating system must be configured so that when passwords are changed or new passwords are established, the new password must contain at least one lower-case character.
Desc Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised.
Severity medium
Impact 0.5
Nist Controls IA-5 (1) (a), Rev_4
Check Text Note: The value to require a number of lower-case characters to be set is expressed as a negative number in "/etc/security/pwquality.conf". Check the value for "lcredit" in "/etc/security/pwquality.conf" with the following command: # grep lcredit /etc/security/pwquality.conf lcredit = -1 If the value of "lcredit" is not set to a negative value, this is a finding.
Fix Text Configure the system to require at least one lower-case character when creating or changing a password. Add or modify the following line in "/etc/security/pwquality.conf": lcredit = -1

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71905" do title "The Red Hat Enterprise Linux operating system must be configured so that when passwords are changed or new passwords are established, the new password must contain at least one lower-case character." desc "Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised. " desc "rationale", "" desc "check", " Note: The value to require a number of lower-case characters to be set is expressed as a negative number in \"/etc/security/pwquality.conf\". Check the value for \"lcredit\" in \"/etc/security/pwquality.conf\" with the following command: # grep lcredit /etc/security/pwquality.conf lcredit = -1 If the value of \"lcredit\" is not set to a negative value, this is a finding. " desc "fix", " Configure the system to require at least one lower-case character when creating or changing a password. Add or modify the following line in \"/etc/security/pwquality.conf\": lcredit = -1 " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000070-GPOS-00038" tag gid: "V-71905" tag rid: "SV-86529r5_rule" tag stig_id: "RHEL-07-010130" tag fix_id: "F-78257r6_fix" tag cci: ["CCI-000193"] tag nist: ["IA-5 (1) (a)", "Rev_4"] describe parse_config_file("/etc/security/pwquality.conf") do its('lcredit.to_i') { should cmp < 0 } end end
To provide availability for name resolution services, multiple redundant name servers are mandated. A failure in name resolution could lead to the failure of security functions requiring name resolution, which may include time synchronization, centralized authentication, and remote system logging.
Test Results

Status passed
Test The system's nameservers: ["nameserver 172.31.0.2"] is expected not to equal nil
Result
Status passed
Test The number of nameservers is expected to cmp >= 2
Result expected it to be >= 2 got: 1 (compared using `cmp` matcher)
Result Details

Control V-72281
Title For Red Hat Enterprise Linux operating systems using DNS resolution, at least two name servers must be configured.
Desc To provide availability for name resolution services, multiple redundant name servers are mandated. A failure in name resolution could lead to the failure of security functions requiring name resolution, which may include time synchronization, centralized authentication, and remote system logging.
Severity low
Impact 0.3
Nist Controls CM-6 b, Rev_4
Check Text Determine whether the system is using local or DNS name resolution with the following command: # grep hosts /etc/nsswitch.conf hosts: files dns If the DNS entry is missing from the host's line in the "/etc/nsswitch.conf" file, the "/etc/resolv.conf" file must be empty. Verify the "/etc/resolv.conf" file is empty with the following command: # ls -al /etc/resolv.conf -rw-r--r-- 1 root root 0 Aug 19 08:31 resolv.conf If local host authentication is being used and the "/etc/resolv.conf" file is not empty, this is a finding. If the DNS entry is found on the host's line of the "/etc/nsswitch.conf" file, verify the operating system is configured to use two or more name servers for DNS resolution. Determine the name servers used by the system with the following command: # grep nameserver /etc/resolv.conf nameserver 192.168.1.2 nameserver 192.168.1.3 If less than two lines are returned that are not commented out, this is a finding.
Fix Text Configure the operating system to use two or more name servers for DNS resolution. Edit the "/etc/resolv.conf" file to uncomment or add the two or more "nameserver" option lines with the IP address of local authoritative name servers. If local host resolution is being performed, the "/etc/resolv.conf" file must be empty. An empty "/etc/resolv.conf" file can be created as follows: # echo -n > /etc/resolv.conf And then make the file immutable with the following command: # chattr +i /etc/resolv.conf If the "/etc/resolv.conf" file must be mutable, the required configuration must be documented with the Information System Security Officer (ISSO) and the file must be verified by the system file integrity tool.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72281" do title "For Red Hat Enterprise Linux operating systems using DNS resolution, at least two name servers must be configured." desc "To provide availability for name resolution services, multiple redundant name servers are mandated. A failure in name resolution could lead to the failure of security functions requiring name resolution, which may include time synchronization, centralized authentication, and remote system logging." desc "rationale", "" desc "check", " Determine whether the system is using local or DNS name resolution with the following command: # grep hosts /etc/nsswitch.conf hosts: files dns If the DNS entry is missing from the host's line in the \"/etc/nsswitch.conf\" file, the \"/etc/resolv.conf\" file must be empty. Verify the \"/etc/resolv.conf\" file is empty with the following command: # ls -al /etc/resolv.conf -rw-r--r-- 1 root root 0 Aug 19 08:31 resolv.conf If local host authentication is being used and the \"/etc/resolv.conf\" file is not empty, this is a finding. If the DNS entry is found on the host's line of the \"/etc/nsswitch.conf\" file, verify the operating system is configured to use two or more name servers for DNS resolution. Determine the name servers used by the system with the following command: # grep nameserver /etc/resolv.conf nameserver 192.168.1.2 nameserver 192.168.1.3 If less than two lines are returned that are not commented out, this is a finding. " desc "fix", " Configure the operating system to use two or more name servers for DNS resolution. Edit the \"/etc/resolv.conf\" file to uncomment or add the two or more \"nameserver\" option lines with the IP address of local authoritative name servers. If local host resolution is being performed, the \"/etc/resolv.conf\" file must be empty. An empty \"/etc/resolv.conf\" file can be created as follows: # echo -n > /etc/resolv.conf And then make the file immutable with the following command: # chattr +i /etc/resolv.conf If the \"/etc/resolv.conf\" file must be mutable, the required configuration must be documented with the Information System Security Officer (ISSO) and the file must be verified by the system file integrity tool. " impact 0.3 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72281" tag rid: "SV-86905r2_rule" tag stig_id: "RHEL-07-040600" tag fix_id: "F-78635r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] dns_in_host_line = parse_config_file("/etc/nsswitch.conf", { comment_char: '#', assignment_regex: /^\s*([^:]*?)\s*:\s*(.*?)\s*$/, } ).params['hosts'].include?('dns') describe "If `local` resolution is being used, a `hosts` entry in /etc/nsswitch.conf having `dns`" do subject { dns_in_host_line } it { should be false } end if !dns_in_host_line describe "If `local` resoultion is being used, the /etc/resolv.conf file should" do subject { parse_config_file("/etc/resolv.conf", { comment_char: '#'}).params } it { should be_empty } end if !dns_in_host_line nameservers = parse_config_file("/etc/resolv.conf", { comment_char: '#'} ).params.keys.grep(/nameserver/) describe "The system's nameservers: #{nameservers}" do subject { nameservers } it { should_not be nil } end if dns_in_host_line describe "The number of nameservers" do subject { nameservers.count } it { should cmp >= 2 } end if dns_in_host_line end
Address space layout randomization (ASLR) makes it more difficult for an attacker to predict the location of attack code he or she has introduced into a process's address space during an attempt at exploitation. Additionally, ASLR also makes it more difficult for an attacker to know the location of existing code in order to repurpose it using return-oriented programming (ROP) techniques.
Test Results

Status passed
Test Kernel Parameter kernel.randomize_va_space value is expected to eq 2
Result
Result Details

Control V-77825
Title The Red Hat Enterprise Linux operating system must implement virtual address space randomization.
Desc Address space layout randomization (ASLR) makes it more difficult for an attacker to predict the location of attack code he or she has introduced into a process's address space during an attempt at exploitation. Additionally, ASLR also makes it more difficult for an attacker to know the location of existing code in order to repurpose it using return-oriented programming (ROP) techniques.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the operating system implements virtual address space randomization. # grep kernel.randomize_va_space /etc/sysctl.conf /etc/sysctl.d/* kernel.randomize_va_space = 2 If "kernel.randomize_va_space" is not configured in the /etc/sysctl.conf file or in the /etc/sysctl.d/ directory, is commented out or does not have a value of "2", this is a finding. Check that the operating system implements virtual address space randomization with the following command: # /sbin/sysctl -a | grep kernel.randomize_va_space kernel.randomize_va_space = 2 If "kernel.randomize_va_space" does not have a value of "2", this is a finding.
Fix Text Configure the operating system implement virtual address space randomization. Set the system to the required kernel parameter by adding the following line to "/etc/sysctl.conf" or a config file in the /etc/sysctl.d/ directory (or modify the line to have the required value): kernel.randomize_va_space = 2 Issue the following command to make the changes take effect: # sysctl --system

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-77825" do title "The Red Hat Enterprise Linux operating system must implement virtual address space randomization." desc "Address space layout randomization (ASLR) makes it more difficult for an attacker to predict the location of attack code he or she has introduced into a process's address space during an attempt at exploitation. Additionally, ASLR also makes it more difficult for an attacker to know the location of existing code in order to repurpose it using return-oriented programming (ROP) techniques." desc "rationale", "" desc "check", " Verify the operating system implements virtual address space randomization. # grep kernel.randomize_va_space /etc/sysctl.conf /etc/sysctl.d/* kernel.randomize_va_space = 2 If \"kernel.randomize_va_space\" is not configured in the /etc/sysctl.conf file or in the /etc/sysctl.d/ directory, is commented out or does not have a value of \"2\", this is a finding. Check that the operating system implements virtual address space randomization with the following command: # /sbin/sysctl -a | grep kernel.randomize_va_space kernel.randomize_va_space = 2 If \"kernel.randomize_va_space\" does not have a value of \"2\", this is a finding. " desc "fix", " Configure the operating system implement virtual address space randomization. Set the system to the required kernel parameter by adding the following line to \"/etc/sysctl.conf\" or a config file in the /etc/sysctl.d/ directory (or modify the line to have the required value): kernel.randomize_va_space = 2 Issue the following command to make the changes take effect: # sysctl --system " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-77825" tag rid: "SV-92521r2_rule" tag stig_id: "RHEL-07-040201" tag fix_id: "F-84531r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] randomize_va_space = input('randomize_va_space') describe kernel_parameter('kernel.randomize_va_space') do its('value') { should eq randomize_va_space } end end
Disabling DCCP protects the system against exploitation of any flaws in the protocol implementation.
Test Results

Status passed
Test Kernel Module dccp is expected not to be loaded
Result
Status passed
Test Kernel Module dccp is expected to be blacklisted
Result
Result Details

Control V-77821
Title The Red Hat Enterprise Linux operating system must be configured so that the Datagram Congestion Control Protocol (DCCP) kernel module is disabled unless required.
Desc Disabling DCCP protects the system against exploitation of any flaws in the protocol implementation.
Severity medium
Impact 0.5
Nist Controls IA-3, Rev_4
Check Text Verify the operating system disables the ability to load the DCCP kernel module. # grep -r dccp /etc/modprobe.d/* | grep -i "/bin/true" | grep -v "^#" install dccp /bin/true If the command does not return any output, or the line is commented out, and use of DCCP is not documented with the Information System Security Officer (ISSO) as an operational requirement, this is a finding. Verify the operating system disables the ability to use the DCCP kernel module. Check to see if the DCCP kernel module is disabled with the following command: # grep -i dccp /etc/modprobe.d/* | grep -i "blacklist" | grep -v "^#" blacklist dccp If the command does not return any output or the output is not "blacklist dccp", and use of the dccp kernel module is not documented with the Information System Security Officer (ISSO) as an operational requirement, this is a finding.
Fix Text Configure the operating system to disable the ability to use the DCCP kernel module. Create a file under "/etc/modprobe.d" with the following command: # touch /etc/modprobe.d/dccp.conf Add the following line to the created file: install dccp /bin/true Ensure that the DCCP module is blacklisted: # vi /etc/modprobe.d/blacklist.conf Add or update the line: blacklist dccp

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-77821" do title "The Red Hat Enterprise Linux operating system must be configured so that the Datagram Congestion Control Protocol (DCCP) kernel module is disabled unless required." desc "Disabling DCCP protects the system against exploitation of any flaws in the protocol implementation." desc "rationale", "" desc "check", " Verify the operating system disables the ability to load the DCCP kernel module. # grep -r dccp /etc/modprobe.d/* | grep -i \"/bin/true\" | grep -v \"^#\" install dccp /bin/true If the command does not return any output, or the line is commented out, and use of DCCP is not documented with the Information System Security Officer (ISSO) as an operational requirement, this is a finding. Verify the operating system disables the ability to use the DCCP kernel module. Check to see if the DCCP kernel module is disabled with the following command: # grep -i dccp /etc/modprobe.d/* | grep -i \"blacklist\" | grep -v \"^#\" blacklist dccp If the command does not return any output or the output is not \"blacklist dccp\", and use of the dccp kernel module is not documented with the Information System Security Officer (ISSO) as an operational requirement, this is a finding. " desc "fix", " Configure the operating system to disable the ability to use the DCCP kernel module. Create a file under \"/etc/modprobe.d\" with the following command: # touch /etc/modprobe.d/dccp.conf Add the following line to the created file: install dccp /bin/true Ensure that the DCCP module is blacklisted: # vi /etc/modprobe.d/blacklist.conf Add or update the line: blacklist dccp " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000378-GPOS-00163" tag gid: "V-77821" tag rid: "SV-92517r3_rule" tag stig_id: "RHEL-07-020101" tag fix_id: "F-84521r3_fix" tag cci: ["CCI-001958"] tag nist: ["IA-3", "Rev_4"] describe kernel_module('dccp') do it { should_not be_loaded } it { should be_blacklisted } end end
If a local interactive user does not own their home directory, unauthorized users could access or modify the user's files, and the users may not be able to access their own files.
Test Results

Status passed
Test Directory /root is expected to exist
Result
Status passed
Test Directory /root owner is expected to eq "root"
Result
Status passed
Test Directory /home/ec2-user is expected to exist
Result
Status passed
Test Directory /home/ec2-user owner is expected to eq "ec2-user"
Result
Result Details

Control V-72019
Title The Red Hat Enterprise Linux operating system must be configured so that all local interactive user home directories are owned by their respective users.
Desc If a local interactive user does not own their home directory, unauthorized users could access or modify the user's files, and the users may not be able to access their own files.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the assigned home directory of all local interactive users on the system exists. Check the home directory assignment for all local interactive users on the system with the following command: # ls -ld $(egrep ':[0-9]{4}' /etc/passwd | cut -d: -f6) -rwxr-x--- 1 smithj users 18 Mar 5 17:06 /home/smithj If any home directories referenced in "/etc/passwd" are not owned by the interactive user, this is a finding.
Fix Text Change the owner of a local interactive user's home directories to that owner. To change the owner of a local interactive user's home directory, use the following command: Note: The example will be for the user smithj, who has a home directory of "/home/smithj". # chown smithj /home/smithj

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72019" do title "The Red Hat Enterprise Linux operating system must be configured so that all local interactive user home directories are owned by their respective users." desc "If a local interactive user does not own their home directory, unauthorized users could access or modify the user's files, and the users may not be able to access their own files." desc "rationale", "" desc "check", " Verify the assigned home directory of all local interactive users on the system exists. Check the home directory assignment for all local interactive users on the system with the following command: # ls -ld $(egrep ':[0-9]{4}' /etc/passwd | cut -d: -f6) -rwxr-x--- 1 smithj users 18 Mar 5 17:06 /home/smithj If any home directories referenced in \"/etc/passwd\" are not owned by the interactive user, this is a finding. " desc "fix", " Change the owner of a local interactive user's home directories to that owner. To change the owner of a local interactive user's home directory, use the following command: Note: The example will be for the user smithj, who has a home directory of \"/home/smithj\". # chown smithj /home/smithj " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72019" tag rid: "SV-86643r5_rule" tag stig_id: "RHEL-07-020640" tag fix_id: "F-78371r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] exempt_home_users = input('exempt_home_users') non_interactive_shells = input('non_interactive_shells') ignore_shells = non_interactive_shells.join('|') uid_min = login_defs.read_params['UID_MIN'].to_i uid_min = 1000 if uid_min.nil? findings = Set[] users.where{ !shell.match(ignore_shells) && (uid >= uid_min || uid == 0)}.entries.each do |user_info| next if exempt_home_users.include?("#{user_info.username}") describe directory(user_info.home) do it { should exist } its('owner') { should eq user_info.username } end end end
Enforcing a minimum password lifetime helps to prevent repeated password changes to defeat the password reuse or history enforcement requirement. If users are allowed to immediately and continually change their password, the password could be repeatedly changed in a short period of time to defeat the organization's policy regarding password reuse.
Test Results

Status passed
Test login.defs PASS_MIN_DAYS.to_i is expected to cmp >= 1
Result
Result Details

Control V-71925
Title The Red Hat Enterprise Linux operating system must be configured so that passwords for new users are restricted to a 24 hours/1 day minimum lifetime.
Desc Enforcing a minimum password lifetime helps to prevent repeated password changes to defeat the password reuse or history enforcement requirement. If users are allowed to immediately and continually change their password, the password could be repeatedly changed in a short period of time to defeat the organization's policy regarding password reuse.
Severity medium
Impact 0.5
Nist Controls IA-5 (1) (d), Rev_4
Check Text Verify the operating system enforces 24 hours/1 day as the minimum password lifetime for new user accounts. Check for the value of "PASS_MIN_DAYS" in "/etc/login.defs" with the following command: # grep -i pass_min_days /etc/login.defs PASS_MIN_DAYS 1 If the "PASS_MIN_DAYS" parameter value is not "1" or greater, or is commented out, this is a finding.
Fix Text Configure the operating system to enforce 24 hours/1 day as the minimum password lifetime. Add the following line in "/etc/login.defs" (or modify the line to have the required value): PASS_MIN_DAYS 1

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71925" do title "The Red Hat Enterprise Linux operating system must be configured so that passwords for new users are restricted to a 24 hours/1 day minimum lifetime." desc "Enforcing a minimum password lifetime helps to prevent repeated password changes to defeat the password reuse or history enforcement requirement. If users are allowed to immediately and continually change their password, the password could be repeatedly changed in a short period of time to defeat the organization's policy regarding password reuse." desc "rationale", "" desc "check", " Verify the operating system enforces 24 hours/1 day as the minimum password lifetime for new user accounts. Check for the value of \"PASS_MIN_DAYS\" in \"/etc/login.defs\" with the following command: # grep -i pass_min_days /etc/login.defs PASS_MIN_DAYS 1 If the \"PASS_MIN_DAYS\" parameter value is not \"1\" or greater, or is commented out, this is a finding. " desc "fix", " Configure the operating system to enforce 24 hours/1 day as the minimum password lifetime. Add the following line in \"/etc/login.defs\" (or modify the line to have the required value): PASS_MIN_DAYS 1 " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000075-GPOS-00043" tag gid: "V-71925" tag rid: "SV-86549r2_rule" tag stig_id: "RHEL-07-010230" tag fix_id: "F-78277r1_fix" tag cci: ["CCI-000198"] tag nist: ["IA-5 (1) (d)", "Rev_4"] describe login_defs do its('PASS_MIN_DAYS.to_i') { should cmp >= 1 } end end
Even though the communications channel may be encrypted, an additional layer of security is gained by extending the policy of not logging on directly as root. In addition, logging on with a user-specific account provides individual accountability of actions performed on the system.
Test Results

Status passed
Test SSHD Configuration PermitRootLogin is expected to cmp == "no"
Result
Result Details

Control V-72247
Title The Red Hat Enterprise Linux operating system must not permit direct logons to the root account using remote access via SSH.
Desc Even though the communications channel may be encrypted, an additional layer of security is gained by extending the policy of not logging on directly as root. In addition, logging on with a user-specific account provides individual accountability of actions performed on the system.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify remote access using SSH prevents users from logging on directly as root. Check that SSH prevents users from logging on directly as root with the following command: # grep -i permitrootlogin /etc/ssh/sshd_config PermitRootLogin no If the "PermitRootLogin" keyword is set to "yes", is missing, or is commented out, this is a finding.
Fix Text Configure SSH to stop users from logging on remotely as the root user. Edit the appropriate "/etc/ssh/sshd_config" file to uncomment or add the line for the "PermitRootLogin" keyword and set its value to "no" (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor): PermitRootLogin no The SSH service must be restarted for changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72247" do title "The Red Hat Enterprise Linux operating system must not permit direct logons to the root account using remote access via SSH." desc "Even though the communications channel may be encrypted, an additional layer of security is gained by extending the policy of not logging on directly as root. In addition, logging on with a user-specific account provides individual accountability of actions performed on the system." desc "rationale", "" desc "check", " Verify remote access using SSH prevents users from logging on directly as root. Check that SSH prevents users from logging on directly as root with the following command: # grep -i permitrootlogin /etc/ssh/sshd_config PermitRootLogin no If the \"PermitRootLogin\" keyword is set to \"yes\", is missing, or is commented out, this is a finding. " desc "fix", " Configure SSH to stop users from logging on remotely as the root user. Edit the appropriate \"/etc/ssh/sshd_config\" file to uncomment or add the line for the \"PermitRootLogin\" keyword and set its value to \"no\" (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor): PermitRootLogin no The SSH service must be restarted for changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72247" tag rid: "SV-86871r3_rule" tag stig_id: "RHEL-07-040370" tag fix_id: "F-78601r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe sshd_config do its('PermitRootLogin') { should cmp 'no' } end end
If security personnel are not notified immediately when the threshold for the repository maximum audit record storage capacity is reached, they are unable to expand the audit record storage capacity before records are lost.
Test Results

Status passed
Test Audit Daemon Config space_left_action.downcase is expected to cmp == "email"
Result
Result Details

Control V-72091
Title The Red Hat Enterprise Linux operating system must immediately notify the System Administrator (SA) and Information System Security Officer (ISSO) (at a minimum) via email when the threshold for the repository maximum audit record storage capacity is reached.
Desc If security personnel are not notified immediately when the threshold for the repository maximum audit record storage capacity is reached, they are unable to expand the audit record storage capacity before records are lost.
Severity medium
Impact 0.5
Nist Controls AU-5 (1), Rev_4
Check Text Verify the operating system immediately notifies the SA and ISSO (at a minimum) via email when the allocated audit record storage volume reaches 75 percent of the repository maximum audit record storage capacity. Check what action the operating system takes when the threshold for the repository maximum audit record storage capacity is reached with the following command: # grep -i space_left_action /etc/audit/auditd.conf space_left_action = email If the value of the "space_left_action" keyword is not set to "email", this is a finding.
Fix Text Configure the operating system to immediately notify the SA and ISSO (at a minimum) when the threshold for the repository maximum audit record storage capacity is reached. Uncomment or edit the "space_left_action" keyword in "/etc/audit/auditd.conf" and set it to "email". space_left_action = email

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72091" do title "The Red Hat Enterprise Linux operating system must immediately notify the System Administrator (SA) and Information System Security Officer (ISSO) (at a minimum) via email when the threshold for the repository maximum audit record storage capacity is reached." desc "If security personnel are not notified immediately when the threshold for the repository maximum audit record storage capacity is reached, they are unable to expand the audit record storage capacity before records are lost." desc "rationale", "" desc "check", " Verify the operating system immediately notifies the SA and ISSO (at a minimum) via email when the allocated audit record storage volume reaches 75 percent of the repository maximum audit record storage capacity. Check what action the operating system takes when the threshold for the repository maximum audit record storage capacity is reached with the following command: # grep -i space_left_action /etc/audit/auditd.conf space_left_action = email If the value of the \"space_left_action\" keyword is not set to \"email\", this is a finding. " desc "fix", " Configure the operating system to immediately notify the SA and ISSO (at a minimum) when the threshold for the repository maximum audit record storage capacity is reached. Uncomment or edit the \"space_left_action\" keyword in \"/etc/audit/auditd.conf\" and set it to \"email\". space_left_action = email " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000343-GPOS-00134" tag gid: "V-72091" tag rid: "SV-86715r2_rule" tag stig_id: "RHEL-07-030340" tag fix_id: "F-78443r1_fix" tag cci: ["CCI-001855"] tag nist: ["AU-5 (1)", "Rev_4"] describe auditd_conf do its('space_left_action.downcase') { should cmp 'email' } end end
If the system does not require valid root authentication before it boots into single-user or maintenance mode, anyone who invokes single-user or maintenance mode is granted privileged access to all files on the system. GRUB 2 is the default boot loader for RHEL 7 and is designed to require a password to boot into single-user mode or make modifications to the boot menu.
Test Results

Status skipped
Test EFI is not in use
Result
Result Details

Control V-71963
Title Red Hat Enterprise Linux operating systems prior to version 7.2 using Unified Extensible Firmware Interface (UEFI) must require authentication upon booting into single-user and maintenance modes.
Desc If the system does not require valid root authentication before it boots into single-user or maintenance mode, anyone who invokes single-user or maintenance mode is granted privileged access to all files on the system. GRUB 2 is the default boot loader for RHEL 7 and is designed to require a password to boot into single-user mode or make modifications to the boot menu.
Severity none
Nist Controls AC-3, Rev_4
Check Text For systems that use BIOS, this is Not Applicable. For systems that are running RHEL 7.2 or newer, this is Not Applicable. Check to see if an encrypted root password is set. On systems that use UEFI, use the following command: # grep -i password /boot/efi/EFI/redhat/grub.cfg password_pbkdf2 [superusers-account] [password-hash] If the root password entry does not begin with "password_pbkdf2", this is a finding. If the "superusers-account" is not set to "root", this is a finding.
Fix Text Configure the system to encrypt the boot password for root. Generate an encrypted grub2 password for root with the following command: Note: The hash generated is an example. # grub2-mkpasswd-pbkdf2 Enter Password: Reenter Password: PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.F3A7CFAA5A51EED123BE8238C23B25B2A6909AFC9812F0D45 Edit "/etc/grub.d/40_custom" and add the following lines below the comments: # vi /etc/grub.d/40_custom set superusers="root" password_pbkdf2 root {hash from grub2-mkpasswd-pbkdf2 command} Generate a new "grub.conf" file with the new password with the following commands: # grub2-mkconfig --output=/tmp/grub2.cfg # mv /tmp/grub2.cfg /boot/efi/EFI/redhat/grub.cfg

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71963" do title "Red Hat Enterprise Linux operating systems prior to version 7.2 using Unified Extensible Firmware Interface (UEFI) must require authentication upon booting into single-user and maintenance modes." desc "If the system does not require valid root authentication before it boots into single-user or maintenance mode, anyone who invokes single-user or maintenance mode is granted privileged access to all files on the system. GRUB 2 is the default boot loader for RHEL 7 and is designed to require a password to boot into single-user mode or make modifications to the boot menu." desc "rationale", "" desc "check", " For systems that use BIOS, this is Not Applicable. For systems that are running RHEL 7.2 or newer, this is Not Applicable. Check to see if an encrypted root password is set. On systems that use UEFI, use the following command: # grep -i password /boot/efi/EFI/redhat/grub.cfg password_pbkdf2 [superusers-account] [password-hash] If the root password entry does not begin with \"password_pbkdf2\", this is a finding. If the \"superusers-account\" is not set to \"root\", this is a finding. " desc "fix", " Configure the system to encrypt the boot password for root. Generate an encrypted grub2 password for root with the following command: Note: The hash generated is an example. # grub2-mkpasswd-pbkdf2 Enter Password: Reenter Password: PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.F3A7CFAA5A51EED123BE8238C23B25B2A6909AFC9812F0D45 Edit \"/etc/grub.d/40_custom\" and add the following lines below the comments: # vi /etc/grub.d/40_custom set superusers=\"root\" password_pbkdf2 root {hash from grub2-mkpasswd-pbkdf2 command} Generate a new \"grub.conf\" file with the new password with the following commands: # grub2-mkconfig --output=/tmp/grub2.cfg # mv /tmp/grub2.cfg /boot/efi/EFI/redhat/grub.cfg " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000080-GPOS-00048" tag gid: "V-71963" tag rid: "SV-86587r4_rule" tag stig_id: "RHEL-07-010490" tag fix_id: "F-78315r3_fix" tag cci: ["CCI-000213"] tag nist: ["AC-3", "Rev_4"] os_minor_version = os().release.split('.')[1].to_i # If OS version is 7.2 or later ONLY root is allowed efi_superusers = os_minor_version < 2 ? input('efi_superusers') : ['root'] # Also ensure that 'root' is in the list always efi_superusers.push('root') if !efi_superusers.include?('root') # Define the main cfg with the os name in the path to allow # for this to work with RHEL variants (e.g. CentOS) efi_main_cfg = "/boot/efi/EFI/#{os().name}/grub.cfg" # If the main EFI config file does not exist this system is # not using EFI and the control is NA if !file(efi_main_cfg).exist? impact 0.0 describe 'EFI is not in use' do skip 'EFI is not in use so this control is NA' end # Ensure any superusers are configured with PBDKF2 passwords else efi_superusers.each do |user| describe file(efi_main_cfg) do its('content') { should match %r{^\s*password_pbkdf2\s+#{user} } } end end end end
Using an authentication device, such as a CAC or token that is separate from the information system, ensures that even if the information system is compromised, that compromise will not affect credentials stored on the authentication device. Multifactor solutions that require devices separate from information systems gaining access include, for example, hardware tokens providing time-based or challenge-response authenticators and smart cards such as the U.S. Government Personal Identity Verification card and the DoD Common Access Card. A privileged account is defined as an information system account with authorizations of a privileged user. Remote access is access to DoD nonpublic information systems by an authorized user (or an information system) communicating through an external, non-organization-controlled network. Remote access methods include, for example, dial-up, broadband, and wireless. This requirement only applies to components where this is specific to the function of the device or has the concept of an organizational user (e.g., VPN, proxy capability). This does not apply to authentication for the purpose of configuring the device itself (management).
Test Results

Status passed
Test Command: `grep -i -E 'services( )*=( )*(.+*)pam' /etc/sssd/sssd.conf` stdout.strip is expected to include "pam"
Result
Result Details

Control V-72427
Title The Red Hat Enterprise Linux operating system must implement multifactor authentication for access to privileged accounts via pluggable authentication modules (PAM).
Desc Using an authentication device, such as a CAC or token that is separate from the information system, ensures that even if the information system is compromised, that compromise will not affect credentials stored on the authentication device. Multifactor solutions that require devices separate from information systems gaining access include, for example, hardware tokens providing time-based or challenge-response authenticators and smart cards such as the U.S. Government Personal Identity Verification card and the DoD Common Access Card. A privileged account is defined as an information system account with authorizations of a privileged user. Remote access is access to DoD nonpublic information systems by an authorized user (or an information system) communicating through an external, non-organization-controlled network. Remote access methods include, for example, dial-up, broadband, and wireless. This requirement only applies to components where this is specific to the function of the device or has the concept of an organizational user (e.g., VPN, proxy capability). This does not apply to authentication for the purpose of configuring the device itself (management).
Severity medium
Impact 0.5
Nist Controls IA-2 (11), IA-2 (12), IA-2 (12), Rev_4
Check Text Verify the operating system implements multifactor authentication for remote access to privileged accounts via pluggable authentication modules (PAM). Check the "/etc/sssd/sssd.conf" file for the authentication services that are being used with the following command: # grep services /etc/sssd/sssd.conf /etc/sssd/conf.d/*.conf services = nss, pam If the "pam" service is not present on all "services" lines, this is a finding.
Fix Text Configure the operating system to implement multifactor authentication for remote access to privileged accounts via pluggable authentication modules (PAM). Modify all of the services lines in "/etc/sssd/sssd.conf" or in configuration files found under "/etc/sssd/conf.d" to include pam.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72427" do title "The Red Hat Enterprise Linux operating system must implement multifactor authentication for access to privileged accounts via pluggable authentication modules (PAM)." desc "Using an authentication device, such as a CAC or token that is separate from the information system, ensures that even if the information system is compromised, that compromise will not affect credentials stored on the authentication device. Multifactor solutions that require devices separate from information systems gaining access include, for example, hardware tokens providing time-based or challenge-response authenticators and smart cards such as the U.S. Government Personal Identity Verification card and the DoD Common Access Card. A privileged account is defined as an information system account with authorizations of a privileged user. Remote access is access to DoD nonpublic information systems by an authorized user (or an information system) communicating through an external, non-organization-controlled network. Remote access methods include, for example, dial-up, broadband, and wireless. This requirement only applies to components where this is specific to the function of the device or has the concept of an organizational user (e.g., VPN, proxy capability). This does not apply to authentication for the purpose of configuring the device itself (management). " desc "rationale", "" desc "check", " Verify the operating system implements multifactor authentication for remote access to privileged accounts via pluggable authentication modules (PAM). Check the \"/etc/sssd/sssd.conf\" file for the authentication services that are being used with the following command: # grep services /etc/sssd/sssd.conf /etc/sssd/conf.d/*.conf services = nss, pam If the \"pam\" service is not present on all \"services\" lines, this is a finding. " desc "fix", " Configure the operating system to implement multifactor authentication for remote access to privileged accounts via pluggable authentication modules (PAM). Modify all of the services lines in \"/etc/sssd/sssd.conf\" or in configuration files found under \"/etc/sssd/conf.d\" to include pam." impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000375-GPOS-00160" tag satisfies: ["SRG-OS-000375-GPOS-00160", "SRG-OS-000375-GPOS-00161", "SRG-OS-000375-GPOS-00162"] tag gid: "V-72427" tag rid: "SV-87051r4_rule" tag stig_id: "RHEL-07-041002" tag fix_id: "F-78779r3_fix" tag cci: ["CCI-001948", "CCI-001953", "CCI-001954"] tag nist: ["IA-2 (11)", "IA-2 (12)", "IA-2 (12)", "Rev_4"] unless package('sssd').installed? impact 0.0 describe "The SSSD Package is not installed on the system" do skip "This control is Not Appliciable without the SSSD Package installed." end else if (!(sssd_files = command("find /etc/sssd -name *.conf").stdout.split("\n")).empty?) sssd_files.each do |file| describe.one do describe parse_config_file(file) do its('services') { should include 'pam' } end if package('sssd').installed? describe command("grep -i -E 'services(\s)*=(\s)*(.+*)pam' #{file}") do its('stdout.strip') { should include 'pam' } end if package('sssd').installed? end if package('sssd').installed? end else describe "The set of SSSD configuration files" do subject { sssd_files.to_a } it { should_not be_empty } end end end end
Unapproved mechanisms that are used for authentication to the cryptographic module are not verified and therefore cannot be relied upon to provide confidentiality or integrity, and DoD data may be compromised. Operating systems utilizing encryption are required to use FIPS-compliant mechanisms for authenticating to cryptographic modules. FIPS 140-2 is the current standard for validating that mechanisms used to access cryptographic modules utilize authentication that meets DoD requirements. This allows for Security Levels 1, 2, 3, or 4 for use on a general purpose computing system.
Test Results

Status passed
Test ["aes128-ctr", "aes192-ctr", "aes256-ctr"] is expected to be in "aes128-ctr", "aes192-ctr", and "aes256-ctr"
Result
Result Details

Control V-72221
Title The Red Hat Enterprise Linux operating system must use a FIPS 140-2 approved cryptographic algorithm for SSH communications.
Desc Unapproved mechanisms that are used for authentication to the cryptographic module are not verified and therefore cannot be relied upon to provide confidentiality or integrity, and DoD data may be compromised. Operating systems utilizing encryption are required to use FIPS-compliant mechanisms for authenticating to cryptographic modules. FIPS 140-2 is the current standard for validating that mechanisms used to access cryptographic modules utilize authentication that meets DoD requirements. This allows for Security Levels 1, 2, 3, or 4 for use on a general purpose computing system.
Severity medium
Impact 0.5
Nist Controls AC-17 (2), CM-6 b, IA-7, Rev_4
Check Text Verify the operating system uses mechanisms meeting the requirements of applicable federal laws, Executive orders, directives, policies, regulations, standards, and guidance for authentication to a cryptographic module. Note: If RHEL-07-021350 is a finding, this is automatically a finding as the system cannot implement FIPS 140-2-approved cryptographic algorithms and hashes. The location of the "sshd_config" file may vary if a different daemon is in use. Inspect the "Ciphers" configuration with the following command: # grep -i ciphers /etc/ssh/sshd_config Ciphers aes128-ctr,aes192-ctr,aes256-ctr If any ciphers other than "aes128-ctr", "aes192-ctr", or "aes256-ctr" are listed, the "Ciphers" keyword is missing, or the returned line is commented out, this is a finding.
Fix Text Configure SSH to use FIPS 140-2 approved cryptographic algorithms. Add the following line (or modify the line to have the required value) to the "/etc/ssh/sshd_config" file (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor). Ciphers aes128-ctr,aes192-ctr,aes256-ctr The SSH service must be restarted for changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72221" do title "The Red Hat Enterprise Linux operating system must use a FIPS 140-2 approved cryptographic algorithm for SSH communications." desc "Unapproved mechanisms that are used for authentication to the cryptographic module are not verified and therefore cannot be relied upon to provide confidentiality or integrity, and DoD data may be compromised. Operating systems utilizing encryption are required to use FIPS-compliant mechanisms for authenticating to cryptographic modules. FIPS 140-2 is the current standard for validating that mechanisms used to access cryptographic modules utilize authentication that meets DoD requirements. This allows for Security Levels 1, 2, 3, or 4 for use on a general purpose computing system. " desc "rationale", "" desc "check", " Verify the operating system uses mechanisms meeting the requirements of applicable federal laws, Executive orders, directives, policies, regulations, standards, and guidance for authentication to a cryptographic module. Note: If RHEL-07-021350 is a finding, this is automatically a finding as the system cannot implement FIPS 140-2-approved cryptographic algorithms and hashes. The location of the \"sshd_config\" file may vary if a different daemon is in use. Inspect the \"Ciphers\" configuration with the following command: # grep -i ciphers /etc/ssh/sshd_config Ciphers aes128-ctr,aes192-ctr,aes256-ctr If any ciphers other than \"aes128-ctr\", \"aes192-ctr\", or \"aes256-ctr\" are listed, the \"Ciphers\" keyword is missing, or the returned line is commented out, this is a finding. " desc "fix", " Configure SSH to use FIPS 140-2 approved cryptographic algorithms. Add the following line (or modify the line to have the required value) to the \"/etc/ssh/sshd_config\" file (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor). Ciphers aes128-ctr,aes192-ctr,aes256-ctr The SSH service must be restarted for changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000033-GPOS-00014" tag satisfies: ["SRG-OS-000033-GPOS-00014", "SRG-OS-000120-GPOS-00061", "SRG-OS-000125-GPOS-00065", "SRG-OS-000250-GPOS-00093", "SRG-OS-000393-GPOS-00173"] tag gid: "V-72221" tag rid: "SV-86845r3_rule" tag stig_id: "RHEL-07-040110" tag fix_id: "F-78575r3_fix" tag cci: ["CCI-000068", "CCI-000366", "CCI-000803"] tag nist: ["AC-17 (2)", "CM-6 b", "IA-7", "Rev_4"] @ciphers_array = inspec.sshd_config.params['ciphers'] unless @ciphers_array.nil? @ciphers_array = @ciphers_array.first.split(",") end describe @ciphers_array do it { should be_in ['aes128-ctr', 'aes192-ctr', 'aes256-ctr'] } end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with syscall == "truncate" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "truncate" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "truncate" arch == "b32" exit.uniq is expected to include "-EPERM"
Result
Status passed
Test Auditd Rules with syscall == "truncate" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "truncate" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "truncate" arch == "b32" exit.uniq is expected to include "-EACCES"
Result
Status passed
Test Auditd Rules with syscall == "truncate" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "truncate" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "truncate" arch == "b64" exit.uniq is expected to include "-EPERM"
Result
Status passed
Test Auditd Rules with syscall == "truncate" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "truncate" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "truncate" arch == "b64" exit.uniq is expected to include "-EACCES"
Result
Result Details

Control V-72131
Title The Red Hat Enterprise Linux operating system must audit all uses of the truncate syscall.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "truncate" syscall occur. Check the file system rules in "/etc/audit/audit.rules" with the following commands: # grep -iw truncate /etc/audit/audit.rules -a always,exit -F arch=b32 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b32 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access If both the "b32" and "b64" audit rules are not defined for the "truncate" syscall, this is a finding. If the output does not produce rules containing "-F exit=-EPERM", this is a finding. If the output does not produce rules containing "-F exit=-EACCES", this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "truncate" syscall occur. Add or update the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b32 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72131" do title "The Red Hat Enterprise Linux operating system must audit all uses of the truncate syscall." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"truncate\" syscall occur. Check the file system rules in \"/etc/audit/audit.rules\" with the following commands: # grep -iw truncate /etc/audit/audit.rules -a always,exit -F arch=b32 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b32 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access If both the \"b32\" and \"b64\" audit rules are not defined for the \"truncate\" syscall, this is a finding. If the output does not produce rules containing \"-F exit=-EPERM\", this is a finding. If the output does not produce rules containing \"-F exit=-EACCES\", this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"truncate\" syscall occur. Add or update the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b32 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S truncate -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S truncate -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000064-GPOS-00033" tag satisfies: ["SRG-OS-000064-GPOS-00033", "SRG-OS-000458-GPOS-00203", "SRG-OS-000461-GPOS-00205", "SRG-OS-000392-GPOS-00172"] tag gid: "V-72131" tag rid: "SV-86755r5_rule" tag stig_id: "RHEL-07-030540" tag fix_id: "F-78483r7_fix" tag cci: ["CCI-000172", "CCI-002884"] tag nist: ["AU-12 c", "MA-4 (1) (a)", "Rev_4"] describe auditd.syscall("truncate").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } its('exit.uniq') { should include '-EPERM' } end describe auditd.syscall("truncate").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } its('exit.uniq') { should include '-EACCES' } end if os.arch == 'x86_64' describe auditd.syscall("truncate").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } its('exit.uniq') { should include '-EPERM' } end describe auditd.syscall("truncate").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } its('exit.uniq') { should include '-EACCES' } end end end
If the system is not configured to audit certain activities and write them to an audit log, it is more difficult to detect and track system compromises and damages incurred during a system compromise.
Test Results

Status passed
Test Auditd Rules with syscall == "rename" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "rename" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "rename" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "rename" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Result Details

Control V-72199
Title The Red Hat Enterprise Linux operating system must audit all uses of the rename syscall.
Desc If the system is not configured to audit certain activities and write them to an audit log, it is more difficult to detect and track system compromises and damages incurred during a system compromise.
Severity medium
Impact 0.5
Nist Controls AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "rename" syscall occur. Check the file system rules in "/etc/audit/audit.rules" with the following commands: # grep -iw rename /etc/audit/audit.rules -a always,exit -F arch=b32 -S rename -F auid>=1000 -F auid!=4294967295 -k delete -a always,exit -F arch=b64 -S rename -F auid>=1000 -F auid!=4294967295 -k delete If both the "b32" and "b64" audit rules are not defined for the "rename" syscall, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "rename" syscall occur. Add the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S rename -F auid>=1000 -F auid!=4294967295 -k delete -a always,exit -F arch=b64 -S rename -F auid>=1000 -F auid!=4294967295 -k delete The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72199" do title "The Red Hat Enterprise Linux operating system must audit all uses of the rename syscall." desc "If the system is not configured to audit certain activities and write them to an audit log, it is more difficult to detect and track system compromises and damages incurred during a system compromise. " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"rename\" syscall occur. Check the file system rules in \"/etc/audit/audit.rules\" with the following commands: # grep -iw rename /etc/audit/audit.rules -a always,exit -F arch=b32 -S rename -F auid>=1000 -F auid!=4294967295 -k delete -a always,exit -F arch=b64 -S rename -F auid>=1000 -F auid!=4294967295 -k delete If both the \"b32\" and \"b64\" audit rules are not defined for the \"rename\" syscall, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"rename\" syscall occur. Add the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S rename -F auid>=1000 -F auid!=4294967295 -k delete -a always,exit -F arch=b64 -S rename -F auid>=1000 -F auid!=4294967295 -k delete The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000466-GPOS-00210" tag satisfies: ["SRG-OS-000466-GPOS-00210", "SRG-OS-000467-GPOS-00210", "SRG-OS-000468-GPOS-00212", "SRG-OS-000392-GPOS-00172"] tag gid: "V-72199" tag rid: "SV-86823r5_rule" tag stig_id: "RHEL-07-030880" tag fix_id: "F-78553r7_fix" tag cci: ["CCI-000172", "CCI-002884"] tag nist: ["AU-12 c", "MA-4 (1) (a)", "Rev_4"] describe auditd.syscall("rename").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end if os.arch == 'x86_64' describe auditd.syscall("rename").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end end end
Without protection of the transmitted information, confidentiality and integrity may be compromised because unprotected communications can be intercepted and either read or altered. This requirement applies to both internal and external networks and all types of information system components from which information can be transmitted (e.g., servers, mobile devices, notebook computers, printers, copiers, scanners, and facsimile machines). Communication paths outside the physical protection of a controlled boundary are exposed to the possibility of interception and modification. Protecting the confidentiality and integrity of organizational information can be accomplished by physical means (e.g., employing physical distribution systems) or by logical means (e.g., employing cryptographic techniques). If physical means of protection are employed, logical means (cryptography) do not have to be employed, and vice versa.
Test Results

Status passed
Test System Package openssh-server is expected to be installed
Result
Status passed
Test System Package openssh-clients is expected to be installed
Result
Result Details

Control V-72233
Title The Red Hat Enterprise Linux operating system must be configured so that all networked systems have SSH installed.
Desc Without protection of the transmitted information, confidentiality and integrity may be compromised because unprotected communications can be intercepted and either read or altered. This requirement applies to both internal and external networks and all types of information system components from which information can be transmitted (e.g., servers, mobile devices, notebook computers, printers, copiers, scanners, and facsimile machines). Communication paths outside the physical protection of a controlled boundary are exposed to the possibility of interception and modification. Protecting the confidentiality and integrity of organizational information can be accomplished by physical means (e.g., employing physical distribution systems) or by logical means (e.g., employing cryptographic techniques). If physical means of protection are employed, logical means (cryptography) do not have to be employed, and vice versa.
Severity medium
Impact 0.5
Nist Controls SC-8, SC-8 (2), SC-8 (1), SC-8 (2), Rev_4
Check Text Check to see if sshd is installed with the following command: # yum list installed \*ssh\* libssh2.x86_64 1.4.3-8.el7 @anaconda/7.1 openssh.x86_64 6.6.1p1-11.el7 @anaconda/7.1 openssh-server.x86_64 6.6.1p1-11.el7 @anaconda/7.1 If the "SSH server" package is not installed, this is a finding.
Fix Text Install SSH packages onto the host with the following commands: # yum install openssh-server.x86_64

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72233" do title "The Red Hat Enterprise Linux operating system must be configured so that all networked systems have SSH installed." desc "Without protection of the transmitted information, confidentiality and integrity may be compromised because unprotected communications can be intercepted and either read or altered. This requirement applies to both internal and external networks and all types of information system components from which information can be transmitted (e.g., servers, mobile devices, notebook computers, printers, copiers, scanners, and facsimile machines). Communication paths outside the physical protection of a controlled boundary are exposed to the possibility of interception and modification. Protecting the confidentiality and integrity of organizational information can be accomplished by physical means (e.g., employing physical distribution systems) or by logical means (e.g., employing cryptographic techniques). If physical means of protection are employed, logical means (cryptography) do not have to be employed, and vice versa. " desc "rationale", "" desc "check", " Check to see if sshd is installed with the following command: # yum list installed \\*ssh\\* libssh2.x86_64 1.4.3-8.el7 @anaconda/7.1 openssh.x86_64 6.6.1p1-11.el7 @anaconda/7.1 openssh-server.x86_64 6.6.1p1-11.el7 @anaconda/7.1 If the \"SSH server\" package is not installed, this is a finding. " desc "fix", " Install SSH packages onto the host with the following commands: # yum install openssh-server.x86_64 " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000423-GPOS-00187" tag satisfies: ["SRG-OS-000423-GPOS-00187", "SRG-OS-000424-GPOS-00188", "SRG-OS-000425-GPOS-00189", "SRG-OS-000426-GPOS-00190"] tag gid: "V-72233" tag rid: "SV-86857r3_rule" tag stig_id: "RHEL-07-040300" tag fix_id: "F-78587r3_fix" tag cci: ["CCI-002418", "CCI-002420", "CCI-002421", "CCI-002422"] tag nist: ["SC-8", "SC-8 (2)", "SC-8 (1)", "SC-8 (2)", "Rev_4"] describe package('openssh-server') do it { should be_installed } end describe package('openssh-clients') do it { should be_installed } end end
If local interactive users are not assigned a valid home directory, there is no place for the storage and control of files they should own.
Test Results

Status passed
Test Directory /root is expected to exist
Result
Status passed
Test Directory /home/ec2-user is expected to exist
Result
Result Details

Control V-72011
Title The Red Hat Enterprise Linux operating system must be configured so that all local interactive users have a home directory assigned in the /etc/passwd file.
Desc If local interactive users are not assigned a valid home directory, there is no place for the storage and control of files they should own.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify local interactive users on the system have a home directory assigned. Check for missing local interactive user home directories with the following command: # pwck -r user 'lp': directory '/var/spool/lpd' does not exist user 'news': directory '/var/spool/news' does not exist user 'uucp': directory '/var/spool/uucp' does not exist user 'smithj': directory '/home/smithj' does not exist Ask the System Administrator (SA) if any users found without home directories are local interactive users. If the SA is unable to provide a response, check for users with a User Identifier (UID) of 1000 or greater with the following command: # cut -d: -f 1,3 /etc/passwd | egrep ":[1-4][0-9]{2}$|:[0-9]{1,2}$" If any interactive users do not have a home directory assigned, this is a finding.
Fix Text Assign home directories to all local interactive users that currently do not have a home directory assigned.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72011" do title "The Red Hat Enterprise Linux operating system must be configured so that all local interactive users have a home directory assigned in the /etc/passwd file." desc "If local interactive users are not assigned a valid home directory, there is no place for the storage and control of files they should own." desc "rationale", "" desc "check", " Verify local interactive users on the system have a home directory assigned. Check for missing local interactive user home directories with the following command: # pwck -r user 'lp': directory '/var/spool/lpd' does not exist user 'news': directory '/var/spool/news' does not exist user 'uucp': directory '/var/spool/uucp' does not exist user 'smithj': directory '/home/smithj' does not exist Ask the System Administrator (SA) if any users found without home directories are local interactive users. If the SA is unable to provide a response, check for users with a User Identifier (UID) of 1000 or greater with the following command: # cut -d: -f 1,3 /etc/passwd | egrep \":[1-4][0-9]{2}$|:[0-9]{1,2}$\" If any interactive users do not have a home directory assigned, this is a finding. " desc "fix", "Assign home directories to all local interactive users that currently do not have a home directory assigned." impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72011" tag rid: "SV-86635r2_rule" tag stig_id: "RHEL-07-020600" tag fix_id: "F-78363r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] exempt_home_users = input('exempt_home_users') non_interactive_shells = input('non_interactive_shells') ignore_shells = non_interactive_shells.join('|') uid_min = login_defs.read_params['UID_MIN'].to_i uid_min = 1000 if uid_min.nil? users.where{ !shell.match(ignore_shells) && (uid >= uid_min || uid == 0)}.entries.each do |user_info| next if exempt_home_users.include?("#{user_info.username}") describe directory(user_info.home) do it { should exist } end end end
Passwords need to be protected at all times, and encryption is the standard method for protecting passwords. If passwords are not encrypted, they can be plainly read (i.e., clear text) and easily compromised. Passwords encrypted with a weak algorithm are no more protected than if they are kept in plain text.
Test Results

Status passed
Test PAM Config[/etc/pam.d/system-auth] lines is expected to include password sufficient pam_unix.so sha512
Result
Status passed
Test PAM Config[/etc/pam.d/system-auth] lines is expected to include password .* pam_unix.so, all without args ^(md5|bigcrypt|sha256|blowfish)$
Result
Result Details

Control V-71919
Title The Red Hat Enterprise Linux operating system must be configured so that the PAM system service is configured to store only encrypted representations of passwords.
Desc Passwords need to be protected at all times, and encryption is the standard method for protecting passwords. If passwords are not encrypted, they can be plainly read (i.e., clear text) and easily compromised. Passwords encrypted with a weak algorithm are no more protected than if they are kept in plain text.
Severity medium
Impact 0.5
Nist Controls IA-5 (1) (c), Rev_4
Check Text Verify the PAM system service is configured to store only encrypted representations of passwords. The strength of encryption that must be used to hash passwords for all accounts is SHA512. Check that the system is configured to create SHA512 hashed passwords with the following command: # grep password /etc/pam.d/system-auth /etc/pam.d/password-auth Outcome should look like following: /etc/pam.d/system-auth-ac:password sufficient pam_unix.so sha512 shadow try_first_pass use_authtok /etc/pam.d/password-auth:password sufficient pam_unix.so sha512 shadow try_first_pass use_authtok If the "/etc/pam.d/system-auth" and "/etc/pam.d/password-auth" configuration files allow for password hashes other than SHA512 to be used, this is a finding.
Fix Text Configure the operating system to store only SHA512 encrypted representations of passwords. Add the following line in "/etc/pam.d/system-auth": pam_unix.so sha512 shadow try_first_pass use_authtok Add the following line in "/etc/pam.d/password-auth": pam_unix.so sha512 shadow try_first_pass use_authtok Note: Manual changes to the listed files may be overwritten by the "authconfig" program. The "authconfig" program should not be used to update the configurations listed in this requirement.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71919" do title "The Red Hat Enterprise Linux operating system must be configured so that the PAM system service is configured to store only encrypted representations of passwords." desc "Passwords need to be protected at all times, and encryption is the standard method for protecting passwords. If passwords are not encrypted, they can be plainly read (i.e., clear text) and easily compromised. Passwords encrypted with a weak algorithm are no more protected than if they are kept in plain text." desc "rationale", "" desc "check", " Verify the PAM system service is configured to store only encrypted representations of passwords. The strength of encryption that must be used to hash passwords for all accounts is SHA512. Check that the system is configured to create SHA512 hashed passwords with the following command: # grep password /etc/pam.d/system-auth /etc/pam.d/password-auth Outcome should look like following: /etc/pam.d/system-auth-ac:password sufficient pam_unix.so sha512 shadow try_first_pass use_authtok /etc/pam.d/password-auth:password sufficient pam_unix.so sha512 shadow try_first_pass use_authtok If the \"/etc/pam.d/system-auth\" and \"/etc/pam.d/password-auth\" configuration files allow for password hashes other than SHA512 to be used, this is a finding. " desc "fix", " Configure the operating system to store only SHA512 encrypted representations of passwords. Add the following line in \"/etc/pam.d/system-auth\": pam_unix.so sha512 shadow try_first_pass use_authtok Add the following line in \"/etc/pam.d/password-auth\": pam_unix.so sha512 shadow try_first_pass use_authtok Note: Manual changes to the listed files may be overwritten by the \"authconfig\" program. The \"authconfig\" program should not be used to update the configurations listed in this requirement. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000073-GPOS-00041" tag gid: "V-71919" tag rid: "SV-86543r3_rule" tag stig_id: "RHEL-07-010200" tag fix_id: "F-78271r4_fix" tag cci: ["CCI-000196"] tag nist: ["IA-5 (1) (c)", "Rev_4"] describe pam("/etc/pam.d/system-auth") do its('lines') { should match_pam_rule('password sufficient pam_unix.so sha512') } its('lines') { should match_pam_rule('password .* pam_unix.so').all_without_args('^(md5|bigcrypt|sha256|blowfish)$') } end end
Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged access commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Test Results

Status passed
Test Auditd Rules with file == "/usr/bin/newgrp" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/usr/bin/newgrp" action is expected not to include "never"
Result
Status passed
Test ["x"] is expected to include "x"
Result
Result Details

Control V-72165
Title The Red Hat Enterprise Linux operating system must audit all uses of the newgrp command.
Desc Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged access commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Severity medium
Impact 0.5
Nist Controls AU-3, AU-3 (1), AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "newgrp" command occur. Check that the following system call is being audited by performing the following command to check the file system rules in "/etc/audit/audit.rules": # grep -i /usr/bin/newgrp /etc/audit/audit.rules -a always,exit -F path=/usr/bin/newgrp -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change If the command does not return any output, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "newgrp" command occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules": -a always,exit -F path=/usr/bin/newgrp -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72165" do title "The Red Hat Enterprise Linux operating system must audit all uses of the newgrp command." desc "Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged access commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise. " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"newgrp\" command occur. Check that the following system call is being audited by performing the following command to check the file system rules in \"/etc/audit/audit.rules\": # grep -i /usr/bin/newgrp /etc/audit/audit.rules -a always,exit -F path=/usr/bin/newgrp -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change If the command does not return any output, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"newgrp\" command occur. Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F path=/usr/bin/newgrp -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000037-GPOS-00015" tag satisfies: ["SRG-OS-000037-GPOS-00015", "SRG-OS-000042-GPOS-00020", "SRG-OS-000392-GPOS-00172", "SRG-OS-000462-GPOS-00206", "SRG-OS-000471-GPOS-00215"] tag gid: "V-72165" tag rid: "SV-86789r4_rule" tag stig_id: "RHEL-07-030710" tag fix_id: "F-78519r5_fix" tag cci: ["CCI-000130", "CCI-000135", "CCI-000172", "CCI-002884"] tag nist: ["AU-3", "AU-3 (1)", "AU-12 c", "MA-4 (1) (a)", "Rev_4"] audit_file = '/usr/bin/newgrp' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'x' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged password commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Test Results

Status passed
Test Auditd Rules with file == "/usr/sbin/userhelper" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/usr/sbin/userhelper" action is expected not to include "never"
Result
Status passed
Test ["x"] is expected to include "x"
Result
Result Details

Control V-72157
Title The Red Hat Enterprise Linux operating system must audit all uses of the userhelper command.
Desc Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged password commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Severity medium
Impact 0.5
Nist Controls AU-3 (1), AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "userhelper" command occur. Check the file system rule in "/etc/audit/audit.rules" with the following command: # grep -i /usr/sbin/userhelper /etc/audit/audit.rules -a always,exit -F path=/usr/sbin/userhelper -F auid>=1000 -F auid!=4294967295 -k privileged-passwd If the command does not return any output, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "userhelper" command occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules": -a always,exit -F path=/usr/sbin/userhelper -F auid>=1000 -F auid!=4294967295 -k privileged-passwd The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72157" do title "The Red Hat Enterprise Linux operating system must audit all uses of the userhelper command." desc "Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged password commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise. " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"userhelper\" command occur. Check the file system rule in \"/etc/audit/audit.rules\" with the following command: # grep -i /usr/sbin/userhelper /etc/audit/audit.rules -a always,exit -F path=/usr/sbin/userhelper -F auid>=1000 -F auid!=4294967295 -k privileged-passwd If the command does not return any output, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"userhelper\" command occur. Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F path=/usr/sbin/userhelper -F auid>=1000 -F auid!=4294967295 -k privileged-passwd The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000042-GPOS-00020" tag satisfies: ["SRG-OS-000042-GPOS-00020", "SRG-OS-000392-GPOS-00172", "SRG-OS-000471-GPOS-00215"] tag gid: "V-72157" tag rid: "SV-86781r5_rule" tag stig_id: "RHEL-07-030670" tag fix_id: "F-78509r5_fix" tag cci: ["CCI-000135", "CCI-000172", "CCI-002884"] tag nist: ["AU-3 (1)", "AU-12 c", "MA-4 (1) (a)", "Rev_4"] audit_file = '/usr/sbin/userhelper' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'x' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with file == "/etc/gshadow" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/etc/gshadow" action is expected not to include "never"
Result
Status passed
Test ["w", "a"] is expected to include "w"
Result
Status passed
Test ["w", "a"] is expected to include "a"
Result
Result Details

Control V-73167
Title The Red Hat Enterprise Linux operating system must generate audit records for all account creations, modifications, disabling, and termination events that affect /etc/gshadow.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AC-2 (4), AU-12 c, AC-2 (4), AC-2 (4), Rev_4
Check Text Verify the operating system must generate audit records for all account creations, modifications, disabling, and termination events that affect "/etc/gshadow". Check the auditing rules in "/etc/audit/audit.rules" with the following command: # grep /etc/gshadow /etc/audit/audit.rules -w /etc/gshadow -p wa -k identity If the command does not return a line, or the line is commented out, this is a finding.
Fix Text Configure the operating system to generate audit records for all account creations, modifications, disabling, and termination events that affect "/etc/gshadow". Add or update the following rule in "/etc/audit/rules.d/audit.rules": -w /etc/gshadow -p wa -k identity The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-73167" do title "The Red Hat Enterprise Linux operating system must generate audit records for all account creations, modifications, disabling, and termination events that affect /etc/gshadow." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system must generate audit records for all account creations, modifications, disabling, and termination events that affect \"/etc/gshadow\". Check the auditing rules in \"/etc/audit/audit.rules\" with the following command: # grep /etc/gshadow /etc/audit/audit.rules -w /etc/gshadow -p wa -k identity If the command does not return a line, or the line is commented out, this is a finding. " desc "fix", " Configure the operating system to generate audit records for all account creations, modifications, disabling, and termination events that affect \"/etc/gshadow\". Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -w /etc/gshadow -p wa -k identity The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000004-GPOS-00004" tag gid: "V-73167" tag rid: "SV-87819r4_rule" tag stig_id: "RHEL-07-030872" tag fix_id: "F-79613r3_fix" tag cci: ["CCI-000018", "CCI-000172", "CCI-001403", "CCI-002130"] tag nist: ["AC-2 (4)", "AU-12 c", "AC-2 (4)", "AC-2 (4)", "Rev_4"] audit_file = '/etc/gshadow' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'w' } it { should include 'a' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
Failure to restrict system access to authenticated users negatively impacts operating system security.
Test Results

Status skipped
Test The system does not have GDM installed
Result
Result Details

Control V-71955
Title The Red Hat Enterprise Linux operating system must not allow an unrestricted logon to the system.
Desc Failure to restrict system access to authenticated users negatively impacts operating system security.
Severity none
Nist Controls CM-6 b, Rev_4
Check Text Verify the operating system does not allow an unrestricted logon to the system via a graphical user interface. Note: If the system does not have GNOME installed, this requirement is Not Applicable. Check for the value of the "TimedLoginEnable" parameter in "/etc/gdm/custom.conf" file with the following command: # grep -i timedloginenable /etc/gdm/custom.conf TimedLoginEnable=false If the value of "TimedLoginEnable" is not set to "false", this is a finding.
Fix Text Configure the operating system to not allow an unrestricted account to log on to the system via a graphical user interface. Note: If the system does not have GNOME installed, this requirement is Not Applicable. Add or edit the line for the "TimedLoginEnable" parameter in the [daemon] section of the "/etc/gdm/custom.conf" file to "false": [daemon] TimedLoginEnable=false

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71955" do title "The Red Hat Enterprise Linux operating system must not allow an unrestricted logon to the system." desc "Failure to restrict system access to authenticated users negatively impacts operating system security." desc "rationale", "" desc "check", " Verify the operating system does not allow an unrestricted logon to the system via a graphical user interface. Note: If the system does not have GNOME installed, this requirement is Not Applicable. Check for the value of the \"TimedLoginEnable\" parameter in \"/etc/gdm/custom.conf\" file with the following command: # grep -i timedloginenable /etc/gdm/custom.conf TimedLoginEnable=false If the value of \"TimedLoginEnable\" is not set to \"false\", this is a finding. " desc "fix", " Configure the operating system to not allow an unrestricted account to log on to the system via a graphical user interface. Note: If the system does not have GNOME installed, this requirement is Not Applicable. Add or edit the line for the \"TimedLoginEnable\" parameter in the [daemon] section of the \"/etc/gdm/custom.conf\" file to \"false\": [daemon] TimedLoginEnable=false " tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00229" tag gid: "V-71955" tag rid: "SV-86579r3_rule" tag stig_id: "RHEL-07-010450" tag fix_id: "F-78307r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] custom_conf = '/etc/gdm/custom.conf' if package('gdm').installed? impact 0.7 if ((f = file(custom_conf)).exist?) describe ini(custom_conf) do its('daemon.TimedLoginEnable') { cmp false } end else describe f do it { should exist } end end else impact 0.0 describe "The system does not have GDM installed" do skip "The system does not have GDM installed, this requirement is Not Applicable." end end end
Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged password commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Test Results

Status passed
Test Auditd Rules with file == "/usr/sbin/unix_chkpwd" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/usr/sbin/unix_chkpwd" action is expected not to include "never"
Result
Status passed
Test ["x"] is expected to include "x"
Result
Result Details

Control V-72151
Title The Red Hat Enterprise Linux operating system must audit all uses of the unix_chkpwd command.
Desc Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged password commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Severity medium
Impact 0.5
Nist Controls AU-3 (1), AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "unix_chkpwd" command occur. Check the file system rule in "/etc/audit/audit.rules" with the following command: # grep -iw /usr/sbin/unix_chkpwd /etc/audit/audit.rules -a always,exit -F path=/usr/sbin/unix_chkpwd -F auid>=1000 -F auid!=4294967295 -k privileged-passwd If the command does not return any output, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "unix_chkpwd" command occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules": -a always,exit -F path=/usr/sbin/unix_chkpwd -F auid>=1000 -F auid!=4294967295 -k privileged-passwd The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72151" do title "The Red Hat Enterprise Linux operating system must audit all uses of the unix_chkpwd command." desc "Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged password commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise. " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"unix_chkpwd\" command occur. Check the file system rule in \"/etc/audit/audit.rules\" with the following command: # grep -iw /usr/sbin/unix_chkpwd /etc/audit/audit.rules -a always,exit -F path=/usr/sbin/unix_chkpwd -F auid>=1000 -F auid!=4294967295 -k privileged-passwd If the command does not return any output, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"unix_chkpwd\" command occur. Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F path=/usr/sbin/unix_chkpwd -F auid>=1000 -F auid!=4294967295 -k privileged-passwd The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000042-GPOS-00020" tag satisfies: ["SRG-OS-000042-GPOS-00020", "SRG-OS-000392-GPOS-00172", "SRG-OS-000471-GPOS-00215"] tag gid: "V-72151" tag rid: "SV-86775r5_rule" tag stig_id: "RHEL-07-030640" tag fix_id: "F-78503r8_fix" tag cci: ["CCI-000135", "CCI-000172", "CCI-002884"] tag nist: ["AU-3 (1)", "AU-12 c", "MA-4 (1) (a)", "Rev_4"] audit_file = '/usr/sbin/unix_chkpwd' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'x' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
Previous versions of software components that are not removed from the information system after updates have been installed may be exploited by adversaries. Some information technology products may remove older versions of software automatically from the information system.
Test Results

Status passed
Test Parse Config File /etc/yum.conf main.clean_requirements_on_remove is expected to match /1|True|yes/i
Result
Result Details

Control V-71987
Title The Red Hat Enterprise Linux operating system must remove all software components after updated versions have been installed.
Desc Previous versions of software components that are not removed from the information system after updates have been installed may be exploited by adversaries. Some information technology products may remove older versions of software automatically from the information system.
Severity low
Impact 0.3
Nist Controls SI-2 (6), Rev_4
Check Text Verify the operating system removes all software components after updated versions have been installed. Check if yum is configured to remove unneeded packages with the following command: # grep -i clean_requirements_on_remove /etc/yum.conf clean_requirements_on_remove=1 If "clean_requirements_on_remove" is not set to "1", "True", or "yes", or is not set in "/etc/yum.conf", this is a finding.
Fix Text Configure the operating system to remove all software components after updated versions have been installed. Set the "clean_requirements_on_remove" option to "1" in the "/etc/yum.conf" file: clean_requirements_on_remove=1

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71987" do title "The Red Hat Enterprise Linux operating system must remove all software components after updated versions have been installed." desc "Previous versions of software components that are not removed from the information system after updates have been installed may be exploited by adversaries. Some information technology products may remove older versions of software automatically from the information system." desc "rationale", "" desc "check", " Verify the operating system removes all software components after updated versions have been installed. Check if yum is configured to remove unneeded packages with the following command: # grep -i clean_requirements_on_remove /etc/yum.conf clean_requirements_on_remove=1 If \"clean_requirements_on_remove\" is not set to \"1\", \"True\", or \"yes\", or is not set in \"/etc/yum.conf\", this is a finding. " desc "fix", " Configure the operating system to remove all software components after updated versions have been installed. Set the \"clean_requirements_on_remove\" option to \"1\" in the \"/etc/yum.conf\" file: clean_requirements_on_remove=1 " impact 0.3 tag severity: nil tag gtitle: "SRG-OS-000437-GPOS-00194" tag gid: "V-71987" tag rid: "SV-86611r2_rule" tag stig_id: "RHEL-07-020200" tag fix_id: "F-78339r1_fix" tag cci: ["CCI-002617"] tag nist: ["SI-2 (6)", "Rev_4"] describe parse_config_file("/etc/yum.conf") do its('main.clean_requirements_on_remove') { should match %r{1|True|yes}i } end end
Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised.
Test Results

Status passed
Test Parse Config File /etc/security/pwquality.conf ocredit.to_i is expected to cmp < 0
Result
Result Details

Control V-71909
Title The Red Hat Enterprise Linux operating system must be configured so that when passwords are changed or new passwords are established, the new password must contain at least one special character.
Desc Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised.
Severity medium
Impact 0.5
Nist Controls IA-5 (1) (a), Rev_4
Check Text Verify the operating system enforces password complexity by requiring that at least one special character be used. Note: The value to require a number of special characters to be set is expressed as a negative number in "/etc/security/pwquality.conf". Check the value for "ocredit" in "/etc/security/pwquality.conf" with the following command: # grep ocredit /etc/security/pwquality.conf ocredit=-1 If the value of "ocredit" is not set to a negative value, this is a finding.
Fix Text Configure the operating system to enforce password complexity by requiring that at least one special character be used by setting the "ocredit" option. Add the following line to "/etc/security/pwquality.conf" (or modify the line to have the required value): ocredit = -1

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71909" do title "The Red Hat Enterprise Linux operating system must be configured so that when passwords are changed or new passwords are established, the new password must contain at least one special character." desc "Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised. " desc "rationale", "" desc "check", " Verify the operating system enforces password complexity by requiring that at least one special character be used. Note: The value to require a number of special characters to be set is expressed as a negative number in \"/etc/security/pwquality.conf\". Check the value for \"ocredit\" in \"/etc/security/pwquality.conf\" with the following command: # grep ocredit /etc/security/pwquality.conf ocredit=-1 If the value of \"ocredit\" is not set to a negative value, this is a finding. " desc "fix", " Configure the operating system to enforce password complexity by requiring that at least one special character be used by setting the \"ocredit\" option. Add the following line to \"/etc/security/pwquality.conf\" (or modify the line to have the required value): ocredit = -1 " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000266-GPOS-00101" tag gid: "V-71909" tag rid: "SV-86533r2_rule" tag stig_id: "RHEL-07-010150" tag fix_id: "F-78261r2_fix" tag cci: ["CCI-001619"] tag nist: ["IA-5 (1) (a)", "Rev_4"] describe parse_config_file("/etc/security/pwquality.conf") do its('ocredit.to_i') { should cmp < 0 } end end
Information stored in one location is vulnerable to accidental or incidental deletion or alteration. Off-loading is a common process in information systems with limited audit storage capacity.
Test Results

Status skipped
Test Parse Config File /etc/audisp/audisp-remote.conf
Result
Result Details

Control V-72085
Title The Red Hat Enterprise Linux operating system must encrypt the transfer of audit records off-loaded onto a different system or media from the system being audited.
Desc Information stored in one location is vulnerable to accidental or incidental deletion or alteration. Off-loading is a common process in information systems with limited audit storage capacity.
Severity medium
Impact 0.5
Nist Controls AU-4 (1), Rev_4
Check Text Verify the operating system encrypts audit records off-loaded onto a different system or media from the system being audited. To determine if the transfer is encrypted, use the following command: # grep -i enable_krb5 /etc/audisp/audisp-remote.conf enable_krb5 = yes If the value of the "enable_krb5" option is not set to "yes" or the line is commented out, ask the System Administrator to indicate how the audit logs are off-loaded to a different system or media. If there is no evidence that the transfer of the audit logs being off-loaded to another system or media is encrypted, this is a finding.
Fix Text Configure the operating system to encrypt the transfer of off-loaded audit records onto a different system or media from the system being audited. Uncomment the "enable_krb5" option in "/etc/audisp/audisp-remote.conf" and set it with the following line: enable_krb5 = yes

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72085" do title "The Red Hat Enterprise Linux operating system must encrypt the transfer of audit records off-loaded onto a different system or media from the system being audited." desc "Information stored in one location is vulnerable to accidental or incidental deletion or alteration. Off-loading is a common process in information systems with limited audit storage capacity. " desc "rationale", "" desc "check", " Verify the operating system encrypts audit records off-loaded onto a different system or media from the system being audited. To determine if the transfer is encrypted, use the following command: # grep -i enable_krb5 /etc/audisp/audisp-remote.conf enable_krb5 = yes If the value of the \"enable_krb5\" option is not set to \"yes\" or the line is commented out, ask the System Administrator to indicate how the audit logs are off-loaded to a different system or media. If there is no evidence that the transfer of the audit logs being off-loaded to another system or media is encrypted, this is a finding. " desc "fix", " Configure the operating system to encrypt the transfer of off-loaded audit records onto a different system or media from the system being audited. Uncomment the \"enable_krb5\" option in \"/etc/audisp/audisp-remote.conf\" and set it with the following line: enable_krb5 = yes " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000342-GPOS-00133" tag satisfies: ["SRG-OS-000342-GPOS-00133", "SRG-OS-000479-GPOS-00224"] tag gid: "V-72085" tag rid: "SV-86709r2_rule" tag stig_id: "RHEL-07-030310" tag fix_id: "F-78437r1_fix" tag cci: ["CCI-001851"] tag nist: ["AU-4 (1)", "Rev_4"] describe parse_config_file('/etc/audisp/audisp-remote.conf') do its('enable_krb5'.to_s) { should cmp 'yes' } end end
Display of a standardized and approved use notification before granting access to the operating system ensures privacy and security notification verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. System use notifications are required only for access via logon interfaces with human users and are not required when such human interfaces do not exist. The banner must be formatted in accordance with applicable DoD policy. Use the following verbiage for operating systems that can accommodate banners of 1300 characters: "You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. By using this IS (which includes any device attached to this IS), you consent to the following conditions: -The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations. -At any time, the USG may inspect and seize data stored on this IS. -Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose. -This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy. -Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details."
Test Results

Status skipped
Test The GNOME desktop is not installed
Result
Result Details

Control V-71859
Title The Red Hat Enterprise Linux operating system must display the Standard Mandatory DoD Notice and Consent Banner before granting local or remote access to the system via a graphical user logon.
Desc Display of a standardized and approved use notification before granting access to the operating system ensures privacy and security notification verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. System use notifications are required only for access via logon interfaces with human users and are not required when such human interfaces do not exist. The banner must be formatted in accordance with applicable DoD policy. Use the following verbiage for operating systems that can accommodate banners of 1300 characters: "You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. By using this IS (which includes any device attached to this IS), you consent to the following conditions: -The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations. -At any time, the USG may inspect and seize data stored on this IS. -Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose. -This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy. -Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details."
Severity none
Nist Controls AC-8 a, Rev_4
Check Text Verify the operating system displays the Standard Mandatory DoD Notice and Consent Banner before granting access to the operating system via a graphical user logon. Note: If the system does not have GNOME installed, this requirement is Not Applicable. Check to see if the operating system displays a banner at the logon screen with the following command: # grep banner-message-enable /etc/dconf/db/local.d/* banner-message-enable=true If "banner-message-enable" is set to "false" or is missing, this is a finding.
Fix Text Configure the operating system to display the Standard Mandatory DoD Notice and Consent Banner before granting access to the system. Note: If the system does not have GNOME installed, this requirement is Not Applicable. Create a database to contain the system-wide graphical user logon settings (if it does not already exist) with the following command: # touch /etc/dconf/db/local.d/01-banner-message Add the following line to the [org/gnome/login-screen] section of the "/etc/dconf/db/local.d/01-banner-message": [org/gnome/login-screen] banner-message-enable=true Update the system databases: # dconf update Users must log out and back in again before the system-wide settings take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71859" do title "The Red Hat Enterprise Linux operating system must display the Standard Mandatory DoD Notice and Consent Banner before granting local or remote access to the system via a graphical user logon." desc "Display of a standardized and approved use notification before granting access to the operating system ensures privacy and security notification verbiage used is consistent with applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. System use notifications are required only for access via logon interfaces with human users and are not required when such human interfaces do not exist. The banner must be formatted in accordance with applicable DoD policy. Use the following verbiage for operating systems that can accommodate banners of 1300 characters: \"You are accessing a U.S. Government (USG) Information System (IS) that is provided for USG-authorized use only. By using this IS (which includes any device attached to this IS), you consent to the following conditions: -The USG routinely intercepts and monitors communications on this IS for purposes including, but not limited to, penetration testing, COMSEC monitoring, network operations and defense, personnel misconduct (PM), law enforcement (LE), and counterintelligence (CI) investigations. -At any time, the USG may inspect and seize data stored on this IS. -Communications using, or data stored on, this IS are not private, are subject to routine monitoring, interception, and search, and may be disclosed or used for any USG-authorized purpose. -This IS includes security measures (e.g., authentication and access controls) to protect USG interests--not for your personal benefit or privacy. -Notwithstanding the above, using this IS does not constitute consent to PM, LE or CI investigative searching or monitoring of the content of privileged communications, or work product, related to personal representation or services by attorneys, psychotherapists, or clergy, and their assistants. Such communications and work product are private and confidential. See User Agreement for details.\" " desc "rationale", "" desc "check", " Verify the operating system displays the Standard Mandatory DoD Notice and Consent Banner before granting access to the operating system via a graphical user logon. Note: If the system does not have GNOME installed, this requirement is Not Applicable. Check to see if the operating system displays a banner at the logon screen with the following command: # grep banner-message-enable /etc/dconf/db/local.d/* banner-message-enable=true If \"banner-message-enable\" is set to \"false\" or is missing, this is a finding. " desc "fix", " Configure the operating system to display the Standard Mandatory DoD Notice and Consent Banner before granting access to the system. Note: If the system does not have GNOME installed, this requirement is Not Applicable. Create a database to contain the system-wide graphical user logon settings (if it does not already exist) with the following command: # touch /etc/dconf/db/local.d/01-banner-message Add the following line to the [org/gnome/login-screen] section of the \"/etc/dconf/db/local.d/01-banner-message\": [org/gnome/login-screen] banner-message-enable=true Update the system databases: # dconf update Users must log out and back in again before the system-wide settings take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000023-GPOS-00006" tag satisfies: ["SRG-OS-000023-GPOS-00006", "SRG-OS-000024-GPOS-00007", "SRG-OS-000228-GPOS-00088"] tag gid: "V-71859" tag rid: "SV-86483r4_rule" tag stig_id: "RHEL-07-010030" tag fix_id: "F-78211r4_fix" tag cci: ["CCI-000048"] tag nist: ["AC-8 a", "Rev_4"] if package('gnome-desktop3').installed? if !dconf_user.nil? and command('whoami').stdout.strip == 'root' describe command("sudo -u #{dconf_user} dconf read /org/gnome/login-screen/banner-message-enable") do its('stdout.strip') { should cmp banner_message_enabled.to_s } end else describe command("dconf read /org/gnome/login-screen/banner-message-enable") do its('stdout.strip') { should cmp banner_message_enabled.to_s } end end else impact 0.0 describe "The GNOME desktop is not installed" do skip "The GNOME desktop is not installed, this control is Not Applicable." end end end
Information stored in one location is vulnerable to accidental or incidental deletion or alteration. Off-loading is a common process in information systems with limited audit storage capacity. When the remote buffer is full, audit logs will not be collected and sent to the central log server.
Test Results

Status passed
Test Parse Config File /etc/audisp/audispd.conf overflow_action is expected to match /syslog$|single$|halt$/i
Result
Result Details

Control V-81019
Title The Red Hat Enterprise Linux operating system must take appropriate action when the audisp-remote buffer is full.
Desc Information stored in one location is vulnerable to accidental or incidental deletion or alteration. Off-loading is a common process in information systems with limited audit storage capacity. When the remote buffer is full, audit logs will not be collected and sent to the central log server.
Severity medium
Impact 0.5
Nist Controls AU-4 (1), Rev_4
Check Text Verify the audisp daemon is configured to take an appropriate action when the internal queue is full: # grep "overflow_action" /etc/audisp/audispd.conf overflow_action = syslog If the "overflow_action" option is not "syslog", "single", or "halt", or the line is commented out, this is a finding.
Fix Text Edit the /etc/audisp/audispd.conf file and add or update the "overflow_action" option: overflow_action = syslog The audit daemon must be restarted for changes to take effect: # service auditd restart

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-81019" do title "The Red Hat Enterprise Linux operating system must take appropriate action when the audisp-remote buffer is full." desc "Information stored in one location is vulnerable to accidental or incidental deletion or alteration. Off-loading is a common process in information systems with limited audit storage capacity. When the remote buffer is full, audit logs will not be collected and sent to the central log server. " desc "rationale", "" desc "check", " Verify the audisp daemon is configured to take an appropriate action when the internal queue is full: # grep \"overflow_action\" /etc/audisp/audispd.conf overflow_action = syslog If the \"overflow_action\" option is not \"syslog\", \"single\", or \"halt\", or the line is commented out, this is a finding. " desc "fix", " Edit the /etc/audisp/audispd.conf file and add or update the \"overflow_action\" option: overflow_action = syslog The audit daemon must be restarted for changes to take effect: # service auditd restart " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000342-GPOS-00133" tag satisfies: ["SRG-OS-000342-GPOS-00133", "SRG-OS-000479-GPOS-00224"] tag gid: "V-81019" tag rid: "SV-95731r1_rule" tag stig_id: "RHEL-07-030210" tag fix_id: "F-87853r3_fix" tag cci: ["CCI-001851"] tag nist: ["AU-4 (1)", "Rev_4"] if file('/etc/audisp/audispd.conf').exist? describe parse_config_file('/etc/audisp/audispd.conf') do its('overflow_action') { should match %r{syslog$|single$|halt$}i } end else describe "File '/etc/audisp/audispd.conf' cannot be found. This test cannot be checked in a automated fashion and you must check it manually" do skip "File '/etc/audisp/audispd.conf' cannot be found. This check must be performed manually" end end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with syscall == "create_module" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "create_module" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "create_module" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "create_module" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Result Details

Control V-78999
Title The Red Hat Enterprise Linux operating system must audit all uses of the create_module syscall.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-12 c, Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "create_module" syscall occur. Check the auditing rules in "/etc/audit/audit.rules" with the following command: # grep -iw create_module /etc/audit/audit.rules -a always,exit -F arch=b32 -S create_module -k module-change -a always,exit -F arch=b64 -S create_module -k module-change If both the "b32" and "b64" audit rules are not defined for the "create_module" syscall, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "create_module" syscall occur. Add or update the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S create_module -k module-change -a always,exit -F arch=b64 -S create_module -k module-change The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-78999" do title "The Red Hat Enterprise Linux operating system must audit all uses of the create_module syscall." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"create_module\" syscall occur. Check the auditing rules in \"/etc/audit/audit.rules\" with the following command: # grep -iw create_module /etc/audit/audit.rules -a always,exit -F arch=b32 -S create_module -k module-change -a always,exit -F arch=b64 -S create_module -k module-change If both the \"b32\" and \"b64\" audit rules are not defined for the \"create_module\" syscall, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"create_module\" syscall occur. Add or update the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S create_module -k module-change -a always,exit -F arch=b64 -S create_module -k module-change The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000471-GPOS-00216" tag satisfies: ["SRG-OS-000471-GPOS-00216", "SRG-OS-000477-GPOS-00222"] tag gid: "V-78999" tag rid: "SV-93705r3_rule" tag stig_id: "RHEL-07-030819" tag fix_id: "F-85749r4_fix" tag cci: ["CCI-000172"] tag nist: ["AU-12 c", "Rev_4"] describe auditd.syscall("create_module").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end if os.arch == 'x86_64' describe auditd.syscall("create_module").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end end end
Terminating an idle SSH session within a short time period reduces the window of opportunity for unauthorized personnel to take control of a management session enabled on the console or console port that has been left unattended. In addition, quickly terminating an idle SSH session will also free up resources committed by the managed network element. Terminating network connections associated with communications sessions includes, for example, de-allocating associated TCP/IP address/port pairs at the operating system level and de-allocating networking assignments at the application level if multiple application sessions are using a single operating system-level network connection. This does not mean that the operating system terminates all sessions or network access; it only ends the inactive session and releases the resources associated with that session.
Test Results

Status skipped
Test The release is 7.8
Result
Result Details

Control V-72241
Title The Red Hat Enterprise Linux operating system must be configured so that all network connections associated with SSH traffic terminate after a period of inactivity.
Desc Terminating an idle SSH session within a short time period reduces the window of opportunity for unauthorized personnel to take control of a management session enabled on the console or console port that has been left unattended. In addition, quickly terminating an idle SSH session will also free up resources committed by the managed network element. Terminating network connections associated with communications sessions includes, for example, de-allocating associated TCP/IP address/port pairs at the operating system level and de-allocating networking assignments at the application level if multiple application sessions are using a single operating system-level network connection. This does not mean that the operating system terminates all sessions or network access; it only ends the inactive session and releases the resources associated with that session.
Severity none
Nist Controls SC-10, AC-12, Rev_4
Check Text Verify the operating system automatically terminates a user session after inactivity time-outs have expired. Check for the value of the "ClientAliveCountMax" keyword with the following command: # grep -i clientalivecount /etc/ssh/sshd_config ClientAliveCountMax 0 If "ClientAliveCountMax" is not set to "0", this is a finding.
Fix Text Configure the operating system to terminate automatically a user session after inactivity time-outs have expired or at shutdown. Add the following line (or modify the line to have the required value) to the "/etc/ssh/sshd_config" file (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor): ClientAliveCountMax 0 The SSH service must be restarted for changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72241" do title "The Red Hat Enterprise Linux operating system must be configured so that all network connections associated with SSH traffic terminate after a period of inactivity." desc "Terminating an idle SSH session within a short time period reduces the window of opportunity for unauthorized personnel to take control of a management session enabled on the console or console port that has been left unattended. In addition, quickly terminating an idle SSH session will also free up resources committed by the managed network element. Terminating network connections associated with communications sessions includes, for example, de-allocating associated TCP/IP address/port pairs at the operating system level and de-allocating networking assignments at the application level if multiple application sessions are using a single operating system-level network connection. This does not mean that the operating system terminates all sessions or network access; it only ends the inactive session and releases the resources associated with that session. " desc "rationale", "" desc "check", " Verify the operating system automatically terminates a user session after inactivity time-outs have expired. Check for the value of the \"ClientAliveCountMax\" keyword with the following command: # grep -i clientalivecount /etc/ssh/sshd_config ClientAliveCountMax 0 If \"ClientAliveCountMax\" is not set to \"0\", this is a finding. " desc "fix", " Configure the operating system to terminate automatically a user session after inactivity time-outs have expired or at shutdown. Add the following line (or modify the line to have the required value) to the \"/etc/ssh/sshd_config\" file (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor): ClientAliveCountMax 0 The SSH service must be restarted for changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000163-GPOS-00072" tag satisfies: ["SRG-OS-000163-GPOS-00072", "SRG-OS-000279-GPOS-00109"] tag gid: "V-72241" tag rid: "SV-86865r4_rule" tag stig_id: "RHEL-07-040340" tag fix_id: "F-78595r4_fix" tag cci: ["CCI-001133", "CCI-002361"] tag nist: ["SC-10", "AC-12", "Rev_4"] if os.release.to_f >= 7.4 impact 0.0 describe "The release is #{os.release}" do skip "The release is newer than 7.4; this control is Not Applicable." end else describe sshd_config do its('ClientAliveCountMax') { should cmp '0' } end end end
Discretionary access control is weakened if a user or group has access permissions to system files and directories greater than the default.
Test Results

Status skipped
Test This control consistently takes a long time to run and has been disabled using the disable_slow_controls attribute.
Result
Result Details

Control V-71849
Title The Red Hat Enterprise Linux operating system must be configured so that the file permissions, ownership, and group membership of system files and commands match the vendor values.
Desc Discretionary access control is weakened if a user or group has access permissions to system files and directories greater than the default.
Severity high
Impact 0.7
Nist Controls AU-9, AU-9 (3), AC-3 (4), AC-6 (10), Rev_4
Check Text Verify the file permissions, ownership, and group membership of system files and commands match the vendor values. Check the default file permissions, ownership, and group membership of system files and commands with the following command: # for i in `rpm -Va | egrep -i '^\.[M|U|G|.]{8}' | cut -d " " -f4,5`;do for j in `rpm -qf $i`;do rpm -ql $j --dump | cut -d " " -f1,5,6,7 | grep $i;done;done /var/log/gdm 040755 root root /etc/audisp/audisp-remote.conf 0100640 root root /usr/bin/passwd 0104755 root root For each file returned, verify the current permissions, ownership, and group membership: # ls -la <filename> -rw-------. 1 root root 133 Jan 11 13:25 /etc/audisp/audisp-remote.conf If the file is more permissive than the default permissions, this is a finding. If the file is not owned by the default owner and is not documented with the Information System Security Officer (ISSO), this is a finding. If the file is not a member of the default group and is not documented with the Information System Security Officer (ISSO), this is a finding.
Fix Text Run the following command to determine which package owns the file: # rpm -qf <filename> Reset the user and group ownership of files within a package with the following command: #rpm --setugids <packagename> Reset the permissions of files within a package with the following command: #rpm --setperms <packagename>

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71849" do title "The Red Hat Enterprise Linux operating system must be configured so that the file permissions, ownership, and group membership of system files and commands match the vendor values." desc "Discretionary access control is weakened if a user or group has access permissions to system files and directories greater than the default. " desc "rationale", "" desc "check", " Verify the file permissions, ownership, and group membership of system files and commands match the vendor values. Check the default file permissions, ownership, and group membership of system files and commands with the following command: # for i in `rpm -Va | egrep -i '^\\.[M|U|G|.]{8}' | cut -d \" \" -f4,5`;do for j in `rpm -qf $i`;do rpm -ql $j --dump | cut -d \" \" -f1,5,6,7 | grep $i;done;done /var/log/gdm 040755 root root /etc/audisp/audisp-remote.conf 0100640 root root /usr/bin/passwd 0104755 root root For each file returned, verify the current permissions, ownership, and group membership: # ls -la <filename> -rw-------. 1 root root 133 Jan 11 13:25 /etc/audisp/audisp-remote.conf If the file is more permissive than the default permissions, this is a finding. If the file is not owned by the default owner and is not documented with the Information System Security Officer (ISSO), this is a finding. If the file is not a member of the default group and is not documented with the Information System Security Officer (ISSO), this is a finding. " desc "fix", " Run the following command to determine which package owns the file: # rpm -qf <filename> Reset the user and group ownership of files within a package with the following command: #rpm --setugids <packagename> Reset the permissions of files within a package with the following command: #rpm --setperms <packagename> " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000257-GPOS-00098" tag satisfies: ["SRG-OS-000257-GPOS-00098", "SRG-OS-000278-GPOS-00108"] tag gid: "V-71849" tag rid: "SV-86473r4_rule" tag stig_id: "RHEL-07-010010" tag fix_id: "F-78201r4_fix" tag cci: ["CCI-001494", "CCI-001496", "CCI-002165", "CCI-002235"] tag nist: ["AU-9", "AU-9 (3)", "AC-3 (4)", "AC-6 (10)", "Rev_4"] if input('disable_slow_controls') describe "This control consistently takes a long time to run and has been disabled using the disable_slow_controls attribute." do skip "This control consistently takes a long time to run and has been disabled using the disable_slow_controls attribute. You must enable this control for a full accredidation for production." end else describe command("rpm -Va | grep '^.M' | awk 'NF>1{print $NF}'").stdout.strip.split("\n") do it { should all(be_in rpm_verify_perms_except) } end end end
If compression is allowed in an SSH connection prior to authentication, vulnerabilities in the compression software could result in compromise of the system from an unauthenticated connection, potentially with root privileges.
Test Results

Status passed
Test SSHD Configuration Compression is expected to cmp == "delayed"
Result
Result Details

Control V-72267
Title The Red Hat Enterprise Linux operating system must be configured so that the SSH daemon does not allow compression or only allows compression after successful authentication.
Desc If compression is allowed in an SSH connection prior to authentication, vulnerabilities in the compression software could result in compromise of the system from an unauthenticated connection, potentially with root privileges.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the SSH daemon performs compression after a user successfully authenticates. Check that the SSH daemon performs compression after a user successfully authenticates with the following command: # grep -i compression /etc/ssh/sshd_config Compression delayed If the "Compression" keyword is set to "yes", is missing, or the returned line is commented out, this is a finding.
Fix Text Uncomment the "Compression" keyword in "/etc/ssh/sshd_config" (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor) on the system and set the value to "delayed" or "no": Compression no The SSH service must be restarted for changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72267" do title "The Red Hat Enterprise Linux operating system must be configured so that the SSH daemon does not allow compression or only allows compression after successful authentication." desc "If compression is allowed in an SSH connection prior to authentication, vulnerabilities in the compression software could result in compromise of the system from an unauthenticated connection, potentially with root privileges." desc "rationale", "" desc "check", " Verify the SSH daemon performs compression after a user successfully authenticates. Check that the SSH daemon performs compression after a user successfully authenticates with the following command: # grep -i compression /etc/ssh/sshd_config Compression delayed If the \"Compression\" keyword is set to \"yes\", is missing, or the returned line is commented out, this is a finding. " desc "fix", " Uncomment the \"Compression\" keyword in \"/etc/ssh/sshd_config\" (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor) on the system and set the value to \"delayed\" or \"no\": Compression no The SSH service must be restarted for changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72267" tag rid: "SV-86891r3_rule" tag stig_id: "RHEL-07-040470" tag fix_id: "F-78621r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe.one do describe sshd_config do its('Compression') { should cmp 'delayed' } end describe sshd_config do its('Compression') { should cmp 'no' } end end end
Unintentionally running a rsyslog server accepting remote messages puts the system at increased risk. Malicious rsyslog messages sent to the server could exploit vulnerabilities in the server software itself, could introduce misleading information in to the system's logs, or could fill the system's storage leading to a Denial of Service. If the system is intended to be a log aggregation server its use must be documented with the ISSO.
Test Results

Status passed
Test File /etc/rsyslog.conf content is expected to match /\$ModLoad\s+imtcp.*\n?$/
Result
Status passed
Test File /etc/rsyslog.conf content is expected not to match /^\$ModLoad\s+imtcp.*\n?$/
Result
Result Details

Control V-72211
Title The Red Hat Enterprise Linux operating system must be configured so that the rsyslog daemon does not accept log messages from other servers unless the server is being used for log aggregation.
Desc Unintentionally running a rsyslog server accepting remote messages puts the system at increased risk. Malicious rsyslog messages sent to the server could exploit vulnerabilities in the server software itself, could introduce misleading information in to the system's logs, or could fill the system's storage leading to a Denial of Service. If the system is intended to be a log aggregation server its use must be documented with the ISSO.
Severity medium
Impact 0.5
Nist Controls CM-3 f, CM-6 c, CM-11 (2), CM-5 (1), CM-5 (1), Rev_4
Check Text Verify that the system is not accepting "rsyslog" messages from other systems unless it is documented as a log aggregation server. Check the configuration of "rsyslog" with the following command: # grep imtcp /etc/rsyslog.conf $ModLoad imtcp # grep imudp /etc/rsyslog.conf $ModLoad imudp # grep imrelp /etc/rsyslog.conf $ModLoad imrelp If any of the above modules are being loaded in the "/etc/rsyslog.conf" file, ask to see the documentation for the system being used for log aggregation. If the documentation does not exist, or does not specify the server as a log aggregation system, this is a finding.
Fix Text Modify the "/etc/rsyslog.conf" file to remove the "ModLoad imtcp", "ModLoad imudp", and "ModLoad imrelp" configuration lines, or document the system as being used for log aggregation.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72211" do title "The Red Hat Enterprise Linux operating system must be configured so that the rsyslog daemon does not accept log messages from other servers unless the server is being used for log aggregation." desc "Unintentionally running a rsyslog server accepting remote messages puts the system at increased risk. Malicious rsyslog messages sent to the server could exploit vulnerabilities in the server software itself, could introduce misleading information in to the system's logs, or could fill the system's storage leading to a Denial of Service. If the system is intended to be a log aggregation server its use must be documented with the ISSO. " desc "rationale", "" desc "check", " Verify that the system is not accepting \"rsyslog\" messages from other systems unless it is documented as a log aggregation server. Check the configuration of \"rsyslog\" with the following command: # grep imtcp /etc/rsyslog.conf $ModLoad imtcp # grep imudp /etc/rsyslog.conf $ModLoad imudp # grep imrelp /etc/rsyslog.conf $ModLoad imrelp If any of the above modules are being loaded in the \"/etc/rsyslog.conf\" file, ask to see the documentation for the system being used for log aggregation. If the documentation does not exist, or does not specify the server as a log aggregation system, this is a finding. " desc "fix", "Modify the \"/etc/rsyslog.conf\" file to remove the \"ModLoad imtcp\", \"ModLoad imudp\", and \"ModLoad imrelp\" configuration lines, or document the system as being used for log aggregation." impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72211" tag rid: "SV-86835r2_rule" tag stig_id: "RHEL-07-031010" tag fix_id: "F-78565r2_fix" tag cci: ["CCI-000318", "CCI-000368", "CCI-001812", "CCI-001813", "CCI-001814"] tag nist: ["CM-3 f", "CM-6 c", "CM-11 (2)", "CM-5 (1)", "CM-5 (1)", "Rev_4"] log_aggregation_server = input('log_aggregation_server') if log_aggregation_server describe file('/etc/rsyslog.conf') do its('content') { should match %r{^\$ModLoad\s+imtcp.*\n?$} } end else describe.one do describe file('/etc/rsyslog.conf') do its('content') { should match %r{\$ModLoad\s+imtcp.*\n?$} } end describe file('/etc/rsyslog.conf') do its('content') { should_not match %r{^\$ModLoad\s+imtcp.*\n?$} } end end end end
Configuring this setting for the SSH daemon provides additional assurance that remote logon via SSH will require a password, even in the event of misconfiguration elsewhere.
Test Results

Status passed
Test SSHD Configuration RhostsRSAAuthentication is expected to cmp == "no"
Result
Result Details

Control V-72239
Title The Red Hat Enterprise Linux operating system must be configured so that the SSH daemon does not allow authentication using RSA rhosts authentication.
Desc Configuring this setting for the SSH daemon provides additional assurance that remote logon via SSH will require a password, even in the event of misconfiguration elsewhere.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Check the version of the operating system with the following command: # cat /etc/redhat-release If the release is 7.4 or newer this requirement is Not Applicable. Verify the SSH daemon does not allow authentication using RSA rhosts authentication. To determine how the SSH daemon's "RhostsRSAAuthentication" option is set, run the following command: # grep RhostsRSAAuthentication /etc/ssh/sshd_config RhostsRSAAuthentication no If the value is returned as "yes", the returned line is commented out, or no output is returned, this is a finding.
Fix Text Configure the SSH daemon to not allow authentication using RSA rhosts authentication. Add the following line in "/etc/ssh/sshd_config", or uncomment the line and set the value to "no": RhostsRSAAuthentication no The SSH service must be restarted for changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72239" do title "The Red Hat Enterprise Linux operating system must be configured so that the SSH daemon does not allow authentication using RSA rhosts authentication." desc "Configuring this setting for the SSH daemon provides additional assurance that remote logon via SSH will require a password, even in the event of misconfiguration elsewhere." desc "rationale", "" desc "check", " Check the version of the operating system with the following command: # cat /etc/redhat-release If the release is 7.4 or newer this requirement is Not Applicable. Verify the SSH daemon does not allow authentication using RSA rhosts authentication. To determine how the SSH daemon's \"RhostsRSAAuthentication\" option is set, run the following command: # grep RhostsRSAAuthentication /etc/ssh/sshd_config RhostsRSAAuthentication no If the value is returned as \"yes\", the returned line is commented out, or no output is returned, this is a finding. " desc "fix", " Configure the SSH daemon to not allow authentication using RSA rhosts authentication. Add the following line in \"/etc/ssh/sshd_config\", or uncomment the line and set the value to \"no\": RhostsRSAAuthentication no The SSH service must be restarted for changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72239" tag rid: "SV-86863r4_rule" tag stig_id: "RHEL-07-040330" tag fix_id: "F-78593r4_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe sshd_config do its('RhostsRSAAuthentication') { should cmp 'no' } end end
To assure accountability and prevent unauthenticated access, users must be identified and authenticated to prevent potential misuse and compromise of the system. Multifactor solutions that require devices separate from information systems gaining access include, for example, hardware tokens providing time-based or challenge-response authenticators and smart cards such as the U.S. Government Personal Identity Verification card and the DoD Common Access Card.
Test Results

Status skipped
Test The GNOME desktop is not installed
Result
Status skipped
Test The pcsc-lite package is not installed
Result
Status skipped
Test The esc package is not installed
Result
Result Details

Control V-77819
Title The Red Hat Enterprise Linux operating system must uniquely identify and must authenticate users using multifactor authentication via a graphical user logon.
Desc To assure accountability and prevent unauthenticated access, users must be identified and authenticated to prevent potential misuse and compromise of the system. Multifactor solutions that require devices separate from information systems gaining access include, for example, hardware tokens providing time-based or challenge-response authenticators and smart cards such as the U.S. Government Personal Identity Verification card and the DoD Common Access Card.
Severity none
Nist Controls IA-2 (11), IA-2 (12), IA-2 (12)
Check Text Verify the operating system uniquely identifies and authenticates users using multifactor authentication via a graphical user logon. Note: If the system does not have GNOME installed, this requirement is Not Applicable. Determine which profile the system database is using with the following command: # grep system-db /etc/dconf/profile/user system-db:local Note: The example is using the database local for the system, so the path is "/etc/dconf/db/local.d". This path must be modified if a database other than local is being used. # grep enable-smartcard-authentication /etc/dconf/db/local.d/* enable-smartcard-authentication=true If "enable-smartcard-authentication" is set to "false" or the keyword is missing, this is a finding.
Fix Text Configure the operating system to uniquely identify and authenticate users using multifactor authentication via a graphical user logon. Note: If the system does not have GNOME installed, this requirement is Not Applicable. Create a database to contain the system-wide screensaver settings (if it does not already exist) with the following command: Note: The example is using the database local for the system, so if the system is using another database in "/etc/dconf/profile/user", the file should be created under the appropriate subdirectory. # touch /etc/dconf/db/local.d/00-defaults Edit "[org/gnome/login-screen]" and add or update the following line: enable-smartcard-authentication=true Update the system databases: # dconf update

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-77819" do title "The Red Hat Enterprise Linux operating system must uniquely identify and must authenticate users using multifactor authentication via a graphical user logon." desc "To assure accountability and prevent unauthenticated access, users must be identified and authenticated to prevent potential misuse and compromise of the system. Multifactor solutions that require devices separate from information systems gaining access include, for example, hardware tokens providing time-based or challenge-response authenticators and smart cards such as the U.S. Government Personal Identity Verification card and the DoD Common Access Card. " desc "rationale", "" desc "check", " Verify the operating system uniquely identifies and authenticates users using multifactor authentication via a graphical user logon. Note: If the system does not have GNOME installed, this requirement is Not Applicable. Determine which profile the system database is using with the following command: # grep system-db /etc/dconf/profile/user system-db:local Note: The example is using the database local for the system, so the path is \"/etc/dconf/db/local.d\". This path must be modified if a database other than local is being used. # grep enable-smartcard-authentication /etc/dconf/db/local.d/* enable-smartcard-authentication=true If \"enable-smartcard-authentication\" is set to \"false\" or the keyword is missing, this is a finding. " desc "fix", " Configure the operating system to uniquely identify and authenticate users using multifactor authentication via a graphical user logon. Note: If the system does not have GNOME installed, this requirement is Not Applicable. Create a database to contain the system-wide screensaver settings (if it does not already exist) with the following command: Note: The example is using the database local for the system, so if the system is using another database in \"/etc/dconf/profile/user\", the file should be created under the appropriate subdirectory. # touch /etc/dconf/db/local.d/00-defaults Edit \"[org/gnome/login-screen]\" and add or update the following line: enable-smartcard-authentication=true Update the system databases: # dconf update " tag severity: nil tag gtitle: "SRG-OS-000375-GPOS-00160" tag satisfies: ["SRG-OS-000375-GPOS-00161", "SRG-OS-000375-GPOS-00162"] tag gid: "V-77819" tag rid: "SV-92515r2_rule" tag stig_id: "RHEL-07-010061" tag fix_id: "F-84519r4_fix" tag cci: ["CCI-001948", "CCI-001953", "CCI-001954"] tag nist: ["IA-2 (11)", "IA-2 (12)", "IA-2 (12)"] multifactor_enabled = input('multifactor_enabled') dconf_user = input('dconf_user') if package('gnome-desktop3').installed? && package('pcsc-lite').installed? || package('esc').installed? impact 0.5 if !dconf_user.nil? && command('whoami').stdout.strip == 'root' describe command("sudo -u #{dconf_user} dconf read /org/gnome/login-screen/enable-smartcard-authentication") do its('stdout.strip') { should eq multifactor_enabled.to_s } end else describe command("dconf read /org/gnome/login-screen/enable-smartcard-authentication") do its('stdout.strip') { should eq multifactor_enabled.to_s } end end else impact 0.0 if !package('gnome-desktop3').installed? describe "The GNOME desktop is not installed" do skip "The GNOME desktop is not installed, this control is Not Applicable." end end if !package('pcsc-lite').installed? describe "The pcsc-lite package is not installed" do skip "The pcsc-lite package is not installed, this control is Not Applicable." end end if !package('esc').installed? describe "The esc package is not installed" do skip "The esc package is not installed, this control is Not Applicable." end end end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with syscall == "lchown" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "lchown" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "lchown" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "lchown" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Result Details

Control V-72101
Title The Red Hat Enterprise Linux operating system must audit all uses of the lchown syscall.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-2 d, AU-12 c, Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "lchown" syscall occur. Check the file system rules in "/etc/audit/audit.rules" with the following commands: # grep -iw lchown /etc/audit/audit.rules -a always,exit -F arch=b32 -S lchown -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S lchown -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the "b32" and "b64" audit rules are not defined for the "lchown" syscall, this is a finding.
Fix Text Add or update the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S lchown -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S lchown -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72101" do title "The Red Hat Enterprise Linux operating system must audit all uses of the lchown syscall." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"lchown\" syscall occur. Check the file system rules in \"/etc/audit/audit.rules\" with the following commands: # grep -iw lchown /etc/audit/audit.rules -a always,exit -F arch=b32 -S lchown -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S lchown -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the \"b32\" and \"b64\" audit rules are not defined for the \"lchown\" syscall, this is a finding. " desc "fix", " Add or update the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S lchown -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S lchown -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000064-GPOS-00033" tag satisfies: ["SRG-OS-000064-GPOS-00033", "SRG-OS-000392-GPOS-00172", "SRG-OS-000458-GPOS-00203", "SRG-OS-000474-GPOS-00219"] tag gid: "V-72101" tag rid: "SV-86725r5_rule" tag stig_id: "RHEL-07-030390" tag fix_id: "F-78453r8_fix" tag cci: ["CCI-000126", "CCI-000172"] tag nist: ["AU-2 d", "AU-12 c", "Rev_4"] describe auditd.syscall("lchown").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end if os.arch == 'x86_64' describe auditd.syscall("lchown").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with syscall == "creat" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "creat" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "creat" arch == "b32" exit.uniq is expected to include "-EPERM"
Result
Status passed
Test Auditd Rules with syscall == "creat" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "creat" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "creat" arch == "b32" exit.uniq is expected to include "-EACCES"
Result
Status passed
Test Auditd Rules with syscall == "creat" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "creat" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "creat" arch == "b64" exit.uniq is expected to include "-EPERM"
Result
Status passed
Test Auditd Rules with syscall == "creat" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "creat" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "creat" arch == "b64" exit.uniq is expected to include "-EACCES"
Result
Result Details

Control V-72123
Title The Red Hat Enterprise Linux operating system must audit all uses of the creat syscall.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "creat" syscall occur. Check the file system rules in "/etc/audit/audit.rules" with the following commands: # grep -iw creat /etc/audit/audit.rules -a always,exit -F arch=b32 -S creat F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access If both the "b32" and "b64" audit rules are not defined for the "creat" syscall, this is a finding. If the output does not produce rules containing "-F exit=-EPERM", this is a finding. If the output does not produce rules containing "-F exit=-EACCES", this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "creat" syscall occur. Add or update the following rules in "/etc/audit/rules.d/audit.rules: -a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72123" do title "The Red Hat Enterprise Linux operating system must audit all uses of the creat syscall." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"creat\" syscall occur. Check the file system rules in \"/etc/audit/audit.rules\" with the following commands: # grep -iw creat /etc/audit/audit.rules -a always,exit -F arch=b32 -S creat F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access If both the \"b32\" and \"b64\" audit rules are not defined for the \"creat\" syscall, this is a finding. If the output does not produce rules containing \"-F exit=-EPERM\", this is a finding. If the output does not produce rules containing \"-F exit=-EACCES\", this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"creat\" syscall occur. Add or update the following rules in \"/etc/audit/rules.d/audit.rules: -a always,exit -F arch=b32 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b32 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S creat -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S creat -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000064-GPOS-00033" tag satisfies: ["SRG-OS-000064-GPOS-00033", "SRG-OS-000458-GPOS-00203", "SRG-OS-000461-GPOS-00205", "SRG-OS-000392-GPOS-00172"] tag gid: "V-72123" tag rid: "SV-86747r5_rule" tag stig_id: "RHEL-07-030500" tag fix_id: "F-78475r7_fix" tag cci: ["CCI-000172", "CCI-002884"] tag nist: ["AU-12 c", "MA-4 (1) (a)", "Rev_4"] describe auditd.syscall("creat").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } its('exit.uniq') { should include '-EPERM' } end describe auditd.syscall("creat").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } its('exit.uniq') { should include '-EACCES' } end if os.arch == 'x86_64' describe auditd.syscall("creat").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } its('exit.uniq') { should include '-EPERM' } end describe auditd.syscall("creat").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } its('exit.uniq') { should include '-EACCES' } end end end
The "nosuid" mount option causes the system to not execute setuid and setgid files with owner privileges. This option must be used for mounting any file system not containing approved setuid and setguid files. Executing files from untrusted file systems increases the opportunity for unprivileged users to attain unauthorized administrative access.
Test Results

Status passed
Test Mount /home options is expected to include "nosuid"
Result expected nil to include "nosuid", but it does not respond to `include?`
Result Details

Control V-72041
Title The Red Hat Enterprise Linux operating system must be configured so that file systems containing user home directories are mounted to prevent files with the setuid and setgid bit set from being executed.
Desc The "nosuid" mount option causes the system to not execute setuid and setgid files with owner privileges. This option must be used for mounting any file system not containing approved setuid and setguid files. Executing files from untrusted file systems increases the opportunity for unprivileged users to attain unauthorized administrative access.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify file systems that contain user home directories are mounted with the "nosuid" option. Find the file system(s) that contain the user home directories with the following command: Note: If a separate file system has not been created for the user home directories (user home directories are mounted under "/"), this is not a finding as the "nosuid" option cannot be used on the "/" system. # cut -d: -f 1,3,6 /etc/passwd | egrep ":[1-4][0-9]{3}" smithj:1001:/home/smithj thomasr:1002:/home/thomasr Check the file systems that are mounted at boot time with the following command: # more /etc/fstab UUID=a411dc99-f2a1-4c87-9e05-184977be8539 /home ext4 rw,relatime,discard,data=ordered,nosuid 0 2 If a file system found in "/etc/fstab" refers to the user home directory file system and it does not have the "nosuid" option set, this is a finding.
Fix Text Configure the "/etc/fstab" to use the "nosuid" option on file systems that contain user home directories.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72041" do title "The Red Hat Enterprise Linux operating system must be configured so that file systems containing user home directories are mounted to prevent files with the setuid and setgid bit set from being executed." desc "The \"nosuid\" mount option causes the system to not execute setuid and setgid files with owner privileges. This option must be used for mounting any file system not containing approved setuid and setguid files. Executing files from untrusted file systems increases the opportunity for unprivileged users to attain unauthorized administrative access." desc "rationale", "" desc "check", " Verify file systems that contain user home directories are mounted with the \"nosuid\" option. Find the file system(s) that contain the user home directories with the following command: Note: If a separate file system has not been created for the user home directories (user home directories are mounted under \"/\"), this is not a finding as the \"nosuid\" option cannot be used on the \"/\" system. # cut -d: -f 1,3,6 /etc/passwd | egrep \":[1-4][0-9]{3}\" smithj:1001:/home/smithj thomasr:1002:/home/thomasr Check the file systems that are mounted at boot time with the following command: # more /etc/fstab UUID=a411dc99-f2a1-4c87-9e05-184977be8539 /home ext4 rw,relatime,discard,data=ordered,nosuid 0 2 If a file system found in \"/etc/fstab\" refers to the user home directory file system and it does not have the \"nosuid\" option set, this is a finding. " desc "fix", "Configure the \"/etc/fstab\" to use the \"nosuid\" option on file systems that contain user home directories." impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72041" tag rid: "SV-86665r4_rule" tag stig_id: "RHEL-07-021000" tag fix_id: "F-78393r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe mount('/home') do its('options') { should include 'nosuid' } end end
Failure to restrict system access to authenticated users negatively impacts operating system security.
Test Results

Status skipped
Test The system does not have GDM installed
Result
Result Details

Control V-71953
Title The Red Hat Enterprise Linux operating system must not allow an unattended or automatic logon to the system via a graphical user interface.
Desc Failure to restrict system access to authenticated users negatively impacts operating system security.
Severity none
Nist Controls CM-6 b, Rev_4
Check Text Verify the operating system does not allow an unattended or automatic logon to the system via a graphical user interface. Note: If the system does not have GNOME installed, this requirement is Not Applicable. Check for the value of the "AutomaticLoginEnable" in the "/etc/gdm/custom.conf" file with the following command: # grep -i automaticloginenable /etc/gdm/custom.conf AutomaticLoginEnable=false If the value of "AutomaticLoginEnable" is not set to "false", this is a finding.
Fix Text Configure the operating system to not allow an unattended or automatic logon to the system via a graphical user interface. Note: If the system does not have GNOME installed, this requirement is Not Applicable. Add or edit the line for the "AutomaticLoginEnable" parameter in the [daemon] section of the "/etc/gdm/custom.conf" file to "false": [daemon] AutomaticLoginEnable=false

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71953" do title "The Red Hat Enterprise Linux operating system must not allow an unattended or automatic logon to the system via a graphical user interface." desc "Failure to restrict system access to authenticated users negatively impacts operating system security." desc "rationale", "" desc "check", " Verify the operating system does not allow an unattended or automatic logon to the system via a graphical user interface. Note: If the system does not have GNOME installed, this requirement is Not Applicable. Check for the value of the \"AutomaticLoginEnable\" in the \"/etc/gdm/custom.conf\" file with the following command: # grep -i automaticloginenable /etc/gdm/custom.conf AutomaticLoginEnable=false If the value of \"AutomaticLoginEnable\" is not set to \"false\", this is a finding. " desc "fix", " Configure the operating system to not allow an unattended or automatic logon to the system via a graphical user interface. Note: If the system does not have GNOME installed, this requirement is Not Applicable. Add or edit the line for the \"AutomaticLoginEnable\" parameter in the [daemon] section of the \"/etc/gdm/custom.conf\" file to \"false\": [daemon] AutomaticLoginEnable=false " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00229" tag gid: "V-71953" tag rid: "SV-86577r2_rule" tag stig_id: "RHEL-07-010440" tag fix_id: "F-78305r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] custom_conf = '/etc/gdm/custom.conf' if package('gdm').installed? if ((f = file(custom_conf)).exist?) describe ini(custom_conf) do its('daemon.AutomaticLoginEnable') { cmp false } end else describe f do it { should exist } end end else impact 0.0 describe "The system does not have GDM installed" do skip "The system does not have GDM installed, this requirement is Not Applicable." end end end
Removing the "ypserv" package decreases the risk of the accidental (or intentional) activation of NIS or NIS+ services.
Test Results

Status passed
Test System Package ypserv is expected not to be installed
Result
Result Details

Control V-71969
Title The Red Hat Enterprise Linux operating system must not have the ypserv package installed.
Desc Removing the "ypserv" package decreases the risk of the accidental (or intentional) activation of NIS or NIS+ services.
Severity high
Impact 0.7
Nist Controls CM-7 a, Rev_4
Check Text The NIS service provides an unencrypted authentication service that does not provide for the confidentiality and integrity of user passwords or the remote session. Check to see if the "ypserve" package is installed with the following command: # yum list installed ypserv If the "ypserv" package is installed, this is a finding.
Fix Text Configure the operating system to disable non-essential capabilities by removing the "ypserv" package from the system with the following command: # yum remove ypserv

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71969" do title "The Red Hat Enterprise Linux operating system must not have the ypserv package installed." desc "Removing the \"ypserv\" package decreases the risk of the accidental (or intentional) activation of NIS or NIS+ services." desc "rationale", "" desc "check", " The NIS service provides an unencrypted authentication service that does not provide for the confidentiality and integrity of user passwords or the remote session. Check to see if the \"ypserve\" package is installed with the following command: # yum list installed ypserv If the \"ypserv\" package is installed, this is a finding. " desc "fix", " Configure the operating system to disable non-essential capabilities by removing the \"ypserv\" package from the system with the following command: # yum remove ypserv " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000095-GPOS-00049" tag gid: "V-71969" tag rid: "SV-86593r2_rule" tag stig_id: "RHEL-07-020010" tag fix_id: "F-78321r1_fix" tag cci: ["CCI-000381"] tag nist: ["CM-7 a", "Rev_4"] describe package("ypserv") do it { should_not be_installed } end end
Excessive permissions on local interactive user home directories may allow unauthorized access to user files by other users.
Test Results

Status passed
Test Home directories with excessive permissions is expected to be empty
Result
Result Details

Control V-72017
Title The Red Hat Enterprise Linux operating system must be configured so that all local interactive user home directories have mode 0750 or less permissive.
Desc Excessive permissions on local interactive user home directories may allow unauthorized access to user files by other users.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the assigned home directory of all local interactive users has a mode of "0750" or less permissive. Check the home directory assignment for all non-privileged users on the system with the following command: Note: This may miss interactive users that have been assigned a privileged User Identifier (UID). Evidence of interactive use may be obtained from a number of log files containing system logon information. # ls -ld $(egrep ':[0-9]{4}' /etc/passwd | cut -d: -f6) -rwxr-x--- 1 smithj users 18 Mar 5 17:06 /home/smithj If home directories referenced in "/etc/passwd" do not have a mode of "0750" or less permissive, this is a finding.
Fix Text Change the mode of interactive user's home directories to "0750". To change the mode of a local interactive user's home directory, use the following command: Note: The example will be for the user "smithj". # chmod 0750 /home/smithj

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72017" do title "The Red Hat Enterprise Linux operating system must be configured so that all local interactive user home directories have mode 0750 or less permissive." desc "Excessive permissions on local interactive user home directories may allow unauthorized access to user files by other users." desc "rationale", "" desc "check", " Verify the assigned home directory of all local interactive users has a mode of \"0750\" or less permissive. Check the home directory assignment for all non-privileged users on the system with the following command: Note: This may miss interactive users that have been assigned a privileged User Identifier (UID). Evidence of interactive use may be obtained from a number of log files containing system logon information. # ls -ld $(egrep ':[0-9]{4}' /etc/passwd | cut -d: -f6) -rwxr-x--- 1 smithj users 18 Mar 5 17:06 /home/smithj If home directories referenced in \"/etc/passwd\" do not have a mode of \"0750\" or less permissive, this is a finding. " desc "fix", " Change the mode of interactive user's home directories to \"0750\". To change the mode of a local interactive user's home directory, use the following command: Note: The example will be for the user \"smithj\". # chmod 0750 /home/smithj " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72017" tag rid: "SV-86641r3_rule" tag stig_id: "RHEL-07-020630" tag fix_id: "F-78369r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] exempt_home_users = input('exempt_home_users') non_interactive_shells = input('non_interactive_shells') ignore_shells = non_interactive_shells.join('|') uid_min = login_defs.read_params['UID_MIN'].to_i uid_min = 1000 if uid_min.nil? findings = Set[] users.where{ !shell.match(ignore_shells) && (uid >= uid_min || uid == 0)}.entries.each do |user_info| next if exempt_home_users.include?("#{user_info.username}") findings = findings + command("find #{user_info.home} -maxdepth 0 -perm /027").stdout.split("\n") end describe "Home directories with excessive permissions" do subject { findings.to_a } it { should be_empty } end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with file == "/usr/bin/kmod" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/usr/bin/kmod" action is expected not to include "never"
Result
Status passed
Test ["x"] is expected to include "x"
Result
Result Details

Control V-72191
Title The Red Hat Enterprise Linux operating system must audit all uses of the kmod command.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-12 c, Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "kmod" command occur. Check the auditing rules in "/etc/audit/audit.rules" with the following command: # grep -iw kmod /etc/audit/audit.rules -w /usr/bin/kmod -p x -F auid!=4294967295 -k module-change If the command does not return any output, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "kmod" command occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules": -w /usr/bin/kmod -p x -F auid!=4294967295 -k module-change The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72191" do title "The Red Hat Enterprise Linux operating system must audit all uses of the kmod command." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"kmod\" command occur. Check the auditing rules in \"/etc/audit/audit.rules\" with the following command: # grep -iw kmod /etc/audit/audit.rules -w /usr/bin/kmod -p x -F auid!=4294967295 -k module-change If the command does not return any output, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"kmod\" command occur. Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -w /usr/bin/kmod -p x -F auid!=4294967295 -k module-change The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000471-GPOS-00216" tag satisfies: ["SRG-OS-000471-GPOS-00216", "SRG-OS-000477-GPOS-00222"] tag gid: "V-72191" tag rid: "SV-86815r5_rule" tag stig_id: "RHEL-07-030840" tag fix_id: "F-78545r10_fix" tag cci: ["CCI-000172"] tag nist: ["AU-12 c", "Rev_4"] audit_file = '/usr/bin/kmod' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'x' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised.
Test Results

Status passed
Test Parse Config File /etc/security/pwquality.conf ucredit.to_i is expected to cmp < 0
Result
Result Details

Control V-71903
Title The Red Hat Enterprise Linux operating system must be configured so that when passwords are changed or new passwords are established, the new password must contain at least one upper-case character.
Desc Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised.
Severity medium
Impact 0.5
Nist Controls IA-5 (1) (a), Rev_4
Check Text Note: The value to require a number of upper-case characters to be set is expressed as a negative number in "/etc/security/pwquality.conf". Check the value for "ucredit" in "/etc/security/pwquality.conf" with the following command: # grep ucredit /etc/security/pwquality.conf ucredit = -1 If the value of "ucredit" is not set to a negative value, this is a finding.
Fix Text Configure the operating system to enforce password complexity by requiring that at least one upper-case character be used by setting the "ucredit" option. Add the following line to "/etc/security/pwquality.conf" (or modify the line to have the required value): ucredit = -1

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71903" do title "The Red Hat Enterprise Linux operating system must be configured so that when passwords are changed or new passwords are established, the new password must contain at least one upper-case character." desc "Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password complexity is one factor of several that determines how long it takes to crack a password. The more complex the password, the greater the number of possible combinations that need to be tested before the password is compromised. " desc "rationale", "" desc "check", " Note: The value to require a number of upper-case characters to be set is expressed as a negative number in \"/etc/security/pwquality.conf\". Check the value for \"ucredit\" in \"/etc/security/pwquality.conf\" with the following command: # grep ucredit /etc/security/pwquality.conf ucredit = -1 If the value of \"ucredit\" is not set to a negative value, this is a finding. " desc "fix", " Configure the operating system to enforce password complexity by requiring that at least one upper-case character be used by setting the \"ucredit\" option. Add the following line to \"/etc/security/pwquality.conf\" (or modify the line to have the required value): ucredit = -1 " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000069-GPOS-00037" tag gid: "V-71903" tag rid: "SV-86527r3_rule" tag stig_id: "RHEL-07-010120" tag fix_id: "F-78255r1_fix" tag cci: ["CCI-000192"] tag nist: ["IA-5 (1) (a)", "Rev_4"] describe parse_config_file("/etc/security/pwquality.conf") do its('ucredit.to_i') { should cmp < 0 } end end
Information stored in one location is vulnerable to accidental or incidental deletion or alteration. Off-loading is a common process in information systems with limited audit storage capacity. When audit logs are not labeled before they are sent to a central log server, the audit data will not be able to be analyzed and tied back to the correct system.
Test Results

Status passed
Test Parse Config File /etc/audisp/audispd.conf name_format is expected to match /^hostname$|^fqd$|^numeric$/i
Result
Result Details

Control V-81021
Title The Red Hat Enterprise Linux operating system must label all off-loaded audit logs before sending them to the central log server.
Desc Information stored in one location is vulnerable to accidental or incidental deletion or alteration. Off-loading is a common process in information systems with limited audit storage capacity. When audit logs are not labeled before they are sent to a central log server, the audit data will not be able to be analyzed and tied back to the correct system.
Severity medium
Impact 0.5
Nist Controls AU-4 (1), Rev_4
Check Text Verify the audisp daemon is configured to label all off-loaded audit logs: # grep "name_format" /etc/audisp/audispd.conf name_format = hostname If the "name_format" option is not "hostname", "fqd", or "numeric", or the line is commented out, this is a finding.
Fix Text Edit the /etc/audisp/audispd.conf file and add or update the "name_format" option: name_format = hostname The audit daemon must be restarted for changes to take effect: # service auditd restart

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-81021" do title "The Red Hat Enterprise Linux operating system must label all off-loaded audit logs before sending them to the central log server." desc "Information stored in one location is vulnerable to accidental or incidental deletion or alteration. Off-loading is a common process in information systems with limited audit storage capacity. When audit logs are not labeled before they are sent to a central log server, the audit data will not be able to be analyzed and tied back to the correct system. " desc "rationale", "" desc "check", " Verify the audisp daemon is configured to label all off-loaded audit logs: # grep \"name_format\" /etc/audisp/audispd.conf name_format = hostname If the \"name_format\" option is not \"hostname\", \"fqd\", or \"numeric\", or the line is commented out, this is a finding. " desc "fix", " Edit the /etc/audisp/audispd.conf file and add or update the \"name_format\" option: name_format = hostname The audit daemon must be restarted for changes to take effect: # service auditd restart " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000342-GPOS-00133" tag satisfies: ["SRG-OS-000342-GPOS-00133", "SRG-OS-000479-GPOS-00224"] tag gid: "V-81021" tag rid: "SV-95733r1_rule" tag stig_id: "RHEL-07-030211" tag fix_id: "F-87855r2_fix" tag cci: ["CCI-001851"] tag nist: ["AU-4 (1)", "Rev_4"] if file('/etc/audisp/audispd.conf').exist? describe parse_config_file('/etc/audisp/audispd.conf') do its('name_format') { should match %r{^hostname$|^fqd$|^numeric$}i } end else describe "File '/etc/audisp/audispd.conf' cannot be found. This test cannot be checked in a automated fashion and you must check it manually" do skip "File '/etc/audisp/audispd.conf' cannot be found. This check must be performed manually" end end end
Cron logging can be used to trace the successful or unsuccessful execution of cron jobs. It can also be used to spot intrusions into the use of the cron facility by unauthorized and malicious users.
Test Results

Status passed
Test Command: `grep cron /etc/rsyslog.conf` stdout.strip is expected to match /^cron/
Result
Result Details

Control V-72051
Title The Red Hat Enterprise Linux operating system must have cron logging implemented.
Desc Cron logging can be used to trace the successful or unsuccessful execution of cron jobs. It can also be used to spot intrusions into the use of the cron facility by unauthorized and malicious users.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify that "rsyslog" is configured to log cron events. Check the configuration of "/etc/rsyslog.conf" or "/etc/rsyslog.d/*.conf" files for the cron facility with the following command: Note: If another logging package is used, substitute the utility configuration file for "/etc/rsyslog.conf" or "/etc/rsyslog.d/*.conf" files. # grep cron /etc/rsyslog.conf /etc/rsyslog.d/*.conf cron.* /var/log/cron.log If the command does not return a response, check for cron logging all facilities by inspecting the "/etc/rsyslog.conf" or "/etc/rsyslog.d/*.conf" files. Look for the following entry: *.* /var/log/messages If "rsyslog" is not logging messages for the cron facility or all facilities, this is a finding.
Fix Text Configure "rsyslog" to log all cron messages by adding or updating the following line to "/etc/rsyslog.conf" or a configuration file in the /etc/rsyslog.d/ directory: cron.* /var/log/cron.log

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72051" do title "The Red Hat Enterprise Linux operating system must have cron logging implemented." desc "Cron logging can be used to trace the successful or unsuccessful execution of cron jobs. It can also be used to spot intrusions into the use of the cron facility by unauthorized and malicious users." desc "rationale", "" desc "check", " Verify that \"rsyslog\" is configured to log cron events. Check the configuration of \"/etc/rsyslog.conf\" or \"/etc/rsyslog.d/*.conf\" files for the cron facility with the following command: Note: If another logging package is used, substitute the utility configuration file for \"/etc/rsyslog.conf\" or \"/etc/rsyslog.d/*.conf\" files. # grep cron /etc/rsyslog.conf /etc/rsyslog.d/*.conf cron.* /var/log/cron.log If the command does not return a response, check for cron logging all facilities by inspecting the \"/etc/rsyslog.conf\" or \"/etc/rsyslog.d/*.conf\" files. Look for the following entry: *.* /var/log/messages If \"rsyslog\" is not logging messages for the cron facility or all facilities, this is a finding. " desc "fix", " Configure \"rsyslog\" to log all cron messages by adding or updating the following line to \"/etc/rsyslog.conf\" or a configuration file in the /etc/rsyslog.d/ directory: cron.* /var/log/cron.log " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72051" tag rid: "SV-86675r2_rule" tag stig_id: "RHEL-07-021100" tag fix_id: "F-78403r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] log_pkg_path = input('log_pkg_path') describe.one do describe command("grep cron #{log_pkg_path}") do its('stdout.strip') { should match %r{^cron} } end describe file("#{log_pkg_path}") do its('content') { should match %r{^\*\.\* \/var\/log\/messages\n?$} } its('content') { should_not match %r{^*.*\s+~$.*^*\.\* \/var\/log\/messages\n?$}m } end end end
Without establishing what type of events occurred, it would be difficult to establish, correlate, and investigate the events leading up to an outage or attack. Audit record content that may be necessary to satisfy this requirement includes, for example, time stamps, source and destination addresses, user/process identifiers, event descriptions, success/fail indications, filenames involved, and access control or flow control rules invoked. Associating event types with detected events in the operating system audit logs provides a means of investigating an attack; recognizing resource utilization or capacity thresholds; or identifying an improperly configured operating system.
Test Results

Status passed
Test Service auditd is expected to be running
Result
Result Details

Control V-72079
Title The Red Hat Enterprise Linux operating system must be configured so that auditing is configured to produce records containing information to establish what type of events occurred, where the events occurred, the source of the events, and the outcome of the events. These audit records must also identify individual identities of group account users.
Desc Without establishing what type of events occurred, it would be difficult to establish, correlate, and investigate the events leading up to an outage or attack. Audit record content that may be necessary to satisfy this requirement includes, for example, time stamps, source and destination addresses, user/process identifiers, event descriptions, success/fail indications, filenames involved, and access control or flow control rules invoked. Associating event types with detected events in the operating system audit logs provides a means of investigating an attack; recognizing resource utilization or capacity thresholds; or identifying an improperly configured operating system.
Severity high
Impact 0.7
Nist Controls AU-2 d, AU-3, Rev_4
Check Text Verify the operating system produces audit records containing information to establish when (date and time) the events occurred. Check to see if auditing is active by issuing the following command: # systemctl is-active auditd.service active If the "auditd" status is not active, this is a finding.
Fix Text Configure the operating system to produce audit records containing information to establish when (date and time) the events occurred. Enable the auditd service with the following command: # systemctl start auditd.service

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72079" do title "The Red Hat Enterprise Linux operating system must be configured so that auditing is configured to produce records containing information to establish what type of events occurred, where the events occurred, the source of the events, and the outcome of the events. These audit records must also identify individual identities of group account users." desc "Without establishing what type of events occurred, it would be difficult to establish, correlate, and investigate the events leading up to an outage or attack. Audit record content that may be necessary to satisfy this requirement includes, for example, time stamps, source and destination addresses, user/process identifiers, event descriptions, success/fail indications, filenames involved, and access control or flow control rules invoked. Associating event types with detected events in the operating system audit logs provides a means of investigating an attack; recognizing resource utilization or capacity thresholds; or identifying an improperly configured operating system. " desc "rationale", "" desc "check", " Verify the operating system produces audit records containing information to establish when (date and time) the events occurred. Check to see if auditing is active by issuing the following command: # systemctl is-active auditd.service active If the \"auditd\" status is not active, this is a finding. " desc "fix", " Configure the operating system to produce audit records containing information to establish when (date and time) the events occurred. Enable the auditd service with the following command: # systemctl start auditd.service " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000038-GPOS-00016" tag satisfies: ["SRG-OS-000038-GPOS-00016", "SRG-OS-000039-GPOS-00017", "SRG-OS-000042-GPOS-00021", "SRG-OS-000254-GPOS-00095", "SRG-OS-000255-GPOS-00096"] tag gid: "V-72079" tag rid: "SV-86703r3_rule" tag stig_id: "RHEL-07-030000" tag fix_id: "F-78431r2_fix" tag cci: ["CCI-000126", "CCI-000131"] tag nist: ["AU-2 d", "AU-3", "Rev_4"] describe service('auditd') do it { should be_running } end end
In order to prevent unauthorized connection of devices, unauthorized transfer of information, or unauthorized tunneling (i.e., embedding of data types within data types), organizations must disable or restrict unused or unnecessary physical and logical ports/protocols on information systems. Operating systems are capable of providing a wide variety of functions and services. Some of the functions and services provided by default may not be necessary to support essential organizational operations. Additionally, it is sometimes convenient to provide multiple services from a single component (e.g., VPN and IPS); however, doing so increases risk over limiting the services provided by any one component. To support the requirements and principles of least functionality, the operating system must support the organizational requirements, providing only essential capabilities and limiting the use of ports, protocols, and/or services to only those required, authorized, and approved to conduct official business or to address authorized quality of life issues.
Test Results

Status passed
Test Firewalld zones are not specified. Check 'firewalld_zones' input. is expected to equal false
Result expected false got true
Result Details

Control V-72219
Title The Red Hat Enterprise Linux operating system must be configured to prohibit or restrict the use of functions, ports, protocols, and/or services, as defined in the Ports, Protocols, and Services Management Component Local Service Assessment (PPSM CLSA) and vulnerability assessments.
Desc In order to prevent unauthorized connection of devices, unauthorized transfer of information, or unauthorized tunneling (i.e., embedding of data types within data types), organizations must disable or restrict unused or unnecessary physical and logical ports/protocols on information systems. Operating systems are capable of providing a wide variety of functions and services. Some of the functions and services provided by default may not be necessary to support essential organizational operations. Additionally, it is sometimes convenient to provide multiple services from a single component (e.g., VPN and IPS); however, doing so increases risk over limiting the services provided by any one component. To support the requirements and principles of least functionality, the operating system must support the organizational requirements, providing only essential capabilities and limiting the use of ports, protocols, and/or services to only those required, authorized, and approved to conduct official business or to address authorized quality of life issues.
Severity medium
Impact 0.5
Nist Controls CM-7 b, AC-17 (1), Rev_4
Check Text Inspect the firewall configuration and running services to verify that it is configured to prohibit or restrict the use of functions, ports, protocols, and/or services that are unnecessary or prohibited. Check which services are currently active with the following command: # firewall-cmd --list-all public (default, active) interfaces: enp0s3 sources: services: dhcpv6-client dns http https ldaps rpc-bind ssh ports: masquerade: no forward-ports: icmp-blocks: rich rules: Ask the System Administrator for the site or program PPSM CLSA. Verify the services allowed by the firewall match the PPSM CLSA. If there are additional ports, protocols, or services that are not in the PPSM CLSA, or there are ports, protocols, or services that are prohibited by the PPSM Category Assurance List (CAL), this is a finding.
Fix Text Update the host's firewall settings and/or running services to comply with the PPSM CLSA for the site or program and the PPSM CAL.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72219" do title "The Red Hat Enterprise Linux operating system must be configured to prohibit or restrict the use of functions, ports, protocols, and/or services, as defined in the Ports, Protocols, and Services Management Component Local Service Assessment (PPSM CLSA) and vulnerability assessments." desc "In order to prevent unauthorized connection of devices, unauthorized transfer of information, or unauthorized tunneling (i.e., embedding of data types within data types), organizations must disable or restrict unused or unnecessary physical and logical ports/protocols on information systems. Operating systems are capable of providing a wide variety of functions and services. Some of the functions and services provided by default may not be necessary to support essential organizational operations. Additionally, it is sometimes convenient to provide multiple services from a single component (e.g., VPN and IPS); however, doing so increases risk over limiting the services provided by any one component. To support the requirements and principles of least functionality, the operating system must support the organizational requirements, providing only essential capabilities and limiting the use of ports, protocols, and/or services to only those required, authorized, and approved to conduct official business or to address authorized quality of life issues. " desc "rationale", "" desc "check", " Inspect the firewall configuration and running services to verify that it is configured to prohibit or restrict the use of functions, ports, protocols, and/or services that are unnecessary or prohibited. Check which services are currently active with the following command: # firewall-cmd --list-all public (default, active) interfaces: enp0s3 sources: services: dhcpv6-client dns http https ldaps rpc-bind ssh ports: masquerade: no forward-ports: icmp-blocks: rich rules: Ask the System Administrator for the site or program PPSM CLSA. Verify the services allowed by the firewall match the PPSM CLSA. If there are additional ports, protocols, or services that are not in the PPSM CLSA, or there are ports, protocols, or services that are prohibited by the PPSM Category Assurance List (CAL), this is a finding. " desc "fix", "Update the host's firewall settings and/or running services to comply with the PPSM CLSA for the site or program and the PPSM CAL." impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000096-GPOS-00050" tag satisfies: ["SRG-OS-000096-GPOS-00050", "SRG-OS-000297-GPOS-00115"] tag gid: "V-72219" tag rid: "SV-86843r2_rule" tag stig_id: "RHEL-07-040100" tag fix_id: "F-78573r1_fix" tag cci: ["CCI-000382", "CCI-002314"] tag nist: ["CM-7 b", "AC-17 (1)", "Rev_4"] firewalld_services_deny = input('firewalld_services_deny') firewalld_hosts_deny = input('firewalld_hosts_deny') firewalld_ports_deny = input('firewalld_ports_deny') firewalld_zones = input('firewalld_zones') iptables_rules = input('iptables_rules') if service('firewalld').running? # Check that the rules specified in 'firewalld_host_deny' are not enabled describe firewalld do firewalld_hosts_deny.each do |rule| it { should_not have_rule_enabled(rule) } end end # Check to make sure zones are specified if firewalld_zones.empty? describe "Firewalld zones are not specified. Check 'firewalld_zones' input." do subject { firewalld_zones.empty? } it { should be false } end end # Check that the services specified in 'firewalld_services_deny' and # ports specified in 'firewalld_ports_deny' are not enabled firewalld_zones.each do |zone| if firewalld.has_zone?(zone) zone_services = firewalld_services_deny["public"] zone_ports = firewalld_ports_deny[zone] if !zone_services.nil? describe firewalld do zone_services.each do |serv| it { should_not have_service_enabled_in_zone(serv,zone) } end end else describe "Services for zone '#{zone}' are not specified. Check 'firewalld_services_deny' input." do subject { zone_services.nil? } it { should be false } end end if !zone_ports.nil? describe firewalld do zone_ports.each do |port| it { should_not have_port_enabled_in_zone(port,zone) } end end else describe "Ports for zone '#{zone}' are not specified. Check 'firewalld_ports_deny' input." do subject { zone_ports.nil? } it { should be false } end end else describe "Firewalld zone '#{zone}' exists" do subject { firewalld.has_zone?(zone) } it { should be true } end end end elsif service('iptables').running? describe iptables do iptables_rules.each do |rule| it { should have_rule(rule) } end end else describe "No application firewall is installed" do subject { service('firewalld').running? || service('iptables').running? } it { should eq true } end end end
Without protection of the transmitted information, confidentiality and integrity may be compromised because unprotected communications can be intercepted and either read or altered. This requirement applies to both internal and external networks and all types of information system components from which information can be transmitted (e.g., servers, mobile devices, notebook computers, printers, copiers, scanners, and facsimile machines). Communication paths outside the physical protection of a controlled boundary are exposed to the possibility of interception and modification. Protecting the confidentiality and integrity of organizational information can be accomplished by physical means (e.g., employing physical distribution systems) or by logical means (e.g., employing cryptographic techniques). If physical means of protection are employed, then logical means (cryptography) do not have to be employed, and vice versa.
Test Results

Status passed
Test Service sshd.service is expected to be running
Result
Result Details

Control V-72235
Title The Red Hat Enterprise Linux operating system must be configured so that all networked systems use SSH for confidentiality and integrity of transmitted and received information as well as information during preparation for transmission.
Desc Without protection of the transmitted information, confidentiality and integrity may be compromised because unprotected communications can be intercepted and either read or altered. This requirement applies to both internal and external networks and all types of information system components from which information can be transmitted (e.g., servers, mobile devices, notebook computers, printers, copiers, scanners, and facsimile machines). Communication paths outside the physical protection of a controlled boundary are exposed to the possibility of interception and modification. Protecting the confidentiality and integrity of organizational information can be accomplished by physical means (e.g., employing physical distribution systems) or by logical means (e.g., employing cryptographic techniques). If physical means of protection are employed, then logical means (cryptography) do not have to be employed, and vice versa.
Severity medium
Impact 0.5
Nist Controls SC-8, SC-8 (2), SC-8 (1), SC-8 (2), Rev_4
Check Text Verify SSH is loaded and active with the following command: # systemctl status sshd sshd.service - OpenSSH server daemon Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled) Active: active (running) since Tue 2015-11-17 15:17:22 EST; 4 weeks 0 days ago Main PID: 1348 (sshd) CGroup: /system.slice/sshd.service 1053 /usr/sbin/sshd -D If "sshd" does not show a status of "active" and "running", this is a finding.
Fix Text Configure the SSH service to automatically start after reboot with the following command: # systemctl enable sshd.service

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72235" do title "The Red Hat Enterprise Linux operating system must be configured so that all networked systems use SSH for confidentiality and integrity of transmitted and received information as well as information during preparation for transmission." desc "Without protection of the transmitted information, confidentiality and integrity may be compromised because unprotected communications can be intercepted and either read or altered. This requirement applies to both internal and external networks and all types of information system components from which information can be transmitted (e.g., servers, mobile devices, notebook computers, printers, copiers, scanners, and facsimile machines). Communication paths outside the physical protection of a controlled boundary are exposed to the possibility of interception and modification. Protecting the confidentiality and integrity of organizational information can be accomplished by physical means (e.g., employing physical distribution systems) or by logical means (e.g., employing cryptographic techniques). If physical means of protection are employed, then logical means (cryptography) do not have to be employed, and vice versa. " desc "rationale", "" desc "check", " Verify SSH is loaded and active with the following command: # systemctl status sshd sshd.service - OpenSSH server daemon Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled) Active: active (running) since Tue 2015-11-17 15:17:22 EST; 4 weeks 0 days ago Main PID: 1348 (sshd) CGroup: /system.slice/sshd.service 1053 /usr/sbin/sshd -D If \"sshd\" does not show a status of \"active\" and \"running\", this is a finding. " desc "fix", " Configure the SSH service to automatically start after reboot with the following command: # systemctl enable sshd.service " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000423-GPOS-00187" tag satisfies: ["SRG-OS-000423-GPOS-00187", "SRG-OS-000423-GPOS-00188", "SRG-OS-000423-GPOS-00189", "SRG-OS-000423-GPOS-00190"] tag gid: "V-72235" tag rid: "SV-86859r3_rule" tag stig_id: "RHEL-07-040310" tag fix_id: "F-78589r2_fix" tag cci: ["CCI-002418", "CCI-002420", "CCI-002421", "CCI-002422"] tag nist: ["SC-8", "SC-8 (2)", "SC-8 (1)", "SC-8 (2)", "Rev_4"] describe systemd_service('sshd.service') do it { should be_running } end end
The shosts.equiv files are used to configure host-based authentication for the system via SSH. Host-based authentication is not sufficient for preventing unauthorized access to the system, as it does not require interactive identification and authentication of a connection request, or for the use of two-factor authentication.
Test Results

Status passed
Test Command: `find / -xautofs -name shosts.equiv` stdout.strip is expected to be empty
Result
Result Details

Control V-72279
Title The Red Hat Enterprise Linux operating system must not contain shosts.equiv files.
Desc The shosts.equiv files are used to configure host-based authentication for the system via SSH. Host-based authentication is not sufficient for preventing unauthorized access to the system, as it does not require interactive identification and authentication of a connection request, or for the use of two-factor authentication.
Severity high
Impact 0.7
Nist Controls CM-6 b, Rev_4
Check Text Verify there are no "shosts.equiv" files on the system. Check the system for the existence of these files with the following command: # find / -name shosts.equiv If any "shosts.equiv" files are found on the system, this is a finding.
Fix Text Remove any found "shosts.equiv" files from the system. # rm /[path]/[to]/[file]/shosts.equiv

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72279" do title "The Red Hat Enterprise Linux operating system must not contain shosts.equiv files." desc "The shosts.equiv files are used to configure host-based authentication for the system via SSH. Host-based authentication is not sufficient for preventing unauthorized access to the system, as it does not require interactive identification and authentication of a connection request, or for the use of two-factor authentication." desc "rationale", "" desc "check", " Verify there are no \"shosts.equiv\" files on the system. Check the system for the existence of these files with the following command: # find / -name shosts.equiv If any \"shosts.equiv\" files are found on the system, this is a finding. " desc "fix", " Remove any found \"shosts.equiv\" files from the system. # rm /[path]/[to]/[file]/shosts.equiv " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72279" tag rid: "SV-86903r2_rule" tag stig_id: "RHEL-07-040550" tag fix_id: "F-78633r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe command('find / -xautofs -name shosts.equiv') do its('stdout.strip') { should be_empty } end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with file == "/var/run/faillock" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/var/run/faillock" action is expected not to include "never"
Result
Status passed
Test ["w", "a"] is expected to include "w"
Result
Status passed
Test ["w", "a"] is expected to include "a"
Result
Result Details

Control V-72145
Title The Red Hat Enterprise Linux operating system must generate audit records for all unsuccessful account access events.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-2 d, AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when unsuccessful account access events occur. Check the file system rule in "/etc/audit/audit.rules" with the following commands: # grep -i /var/run/faillock /etc/audit/audit.rules -w /var/run/faillock -p wa -k logins If the command does not return any output, this is a finding.
Fix Text Configure the operating system to generate audit records when unsuccessful account access events occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules": -w /var/run/faillock -p wa -k logins The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72145" do title "The Red Hat Enterprise Linux operating system must generate audit records for all unsuccessful account access events." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when unsuccessful account access events occur. Check the file system rule in \"/etc/audit/audit.rules\" with the following commands: # grep -i /var/run/faillock /etc/audit/audit.rules -w /var/run/faillock -p wa -k logins If the command does not return any output, this is a finding. " desc "fix", " Configure the operating system to generate audit records when unsuccessful account access events occur. Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -w /var/run/faillock -p wa -k logins The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000392-GPOS-00172" tag satisfies: ["SRG-OS-000392-GPOS-00172", "SRG-OS-000470-GPOS-00214", "SRG-OS-000473-GPOS-00218"] tag gid: "V-72145" tag rid: "SV-86769r4_rule" tag stig_id: "RHEL-07-030610" tag fix_id: "F-78497r4_fix" tag cci: ["CCI-000126", "CCI-000172", "CCI-002884"] tag nist: ["AU-2 d", "AU-12 c", "MA-4 (1) (a)", "Rev_4"] audit_file = '/var/run/faillock' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'w' } it { should include 'a' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
A locally logged-on user who presses Ctrl-Alt-Delete, when at the console, can reboot the system. If accidentally pressed, as could happen in the case of a mixed OS environment, this can create the risk of short-term loss of availability of systems due to unintentional reboot. In the GNOME graphical environment, risk of unintentional reboot from the Ctrl-Alt-Delete sequence is reduced because the user will be prompted before any action is taken.
Test Results

Status skipped
Test The system does not have GNOME installed
Result
Result Details

Control V-94843
Title The Red Hat Enterprise Linux operating system must be configured so that the x86 Ctrl-Alt-Delete key sequence is disabled in the GUI.
Desc A locally logged-on user who presses Ctrl-Alt-Delete, when at the console, can reboot the system. If accidentally pressed, as could happen in the case of a mixed OS environment, this can create the risk of short-term loss of availability of systems due to unintentional reboot. In the GNOME graphical environment, risk of unintentional reboot from the Ctrl-Alt-Delete sequence is reduced because the user will be prompted before any action is taken.
Severity none
Nist Controls CM-6 b, Rev_4
Check Text Verify the operating system is not configured to reboot the system when Ctrl-Alt-Delete is pressed. Check that the ctrl-alt-del.target is masked and not active in the GUI with the following command: # grep logout /etc/dconf/local.d/* logout='' If "logout" is not set to use two single quotations, or is missing, this is a finding.
Fix Text Configure the system to disable the Ctrl-Alt-Delete sequence for the GUI with the following command: # touch /etc/dconf/db/local.d/00-disable-CAD Add the setting to disable the Ctrl-Alt-Delete sequence for GNOME: [org/gnome/settings-daemon/plugins/media-keys] logout=''

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-94843" do title "The Red Hat Enterprise Linux operating system must be configured so that the x86 Ctrl-Alt-Delete key sequence is disabled in the GUI." desc "A locally logged-on user who presses Ctrl-Alt-Delete, when at the console, can reboot the system. If accidentally pressed, as could happen in the case of a mixed OS environment, this can create the risk of short-term loss of availability of systems due to unintentional reboot. In the GNOME graphical environment, risk of unintentional reboot from the Ctrl-Alt-Delete sequence is reduced because the user will be prompted before any action is taken." desc "rationale", "" desc "check", " Verify the operating system is not configured to reboot the system when Ctrl-Alt-Delete is pressed. Check that the ctrl-alt-del.target is masked and not active in the GUI with the following command: # grep logout /etc/dconf/local.d/* logout='' If \"logout\" is not set to use two single quotations, or is missing, this is a finding. " desc "fix", " Configure the system to disable the Ctrl-Alt-Delete sequence for the GUI with the following command: # touch /etc/dconf/db/local.d/00-disable-CAD Add the setting to disable the Ctrl-Alt-Delete sequence for GNOME: [org/gnome/settings-daemon/plugins/media-keys] logout='' " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-94843" tag rid: "SV-104673r1_rule" tag stig_id: "RHEL-07-020231" tag fix_id: "F-100967r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] unless package('gnome-settings-daemon').installed? impact 0.0 describe "The system does not have GNOME installed" do skip "The system does not have GNOME installed, this requirement is Not Applicable." end else describe command("gsettings get org.gnome.settings-daemon.media-keys logout") do its('stdout.strip') { should cmp "''" } end end end
Configuring this setting for the SSH daemon provides additional assurance that remote logon via SSH will require a password, even in the event of misconfiguration elsewhere.
Test Results

Status passed
Test SSHD Configuration IgnoreUserKnownHosts is expected to cmp == "yes"
Result
Result Details

Control V-72249
Title The Red Hat Enterprise Linux operating system must be configured so that the SSH daemon does not allow authentication using known hosts authentication.
Desc Configuring this setting for the SSH daemon provides additional assurance that remote logon via SSH will require a password, even in the event of misconfiguration elsewhere.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the SSH daemon does not allow authentication using known hosts authentication. To determine how the SSH daemon's "IgnoreUserKnownHosts" option is set, run the following command: # grep -i IgnoreUserKnownHosts /etc/ssh/sshd_config IgnoreUserKnownHosts yes If the value is returned as "no", the returned line is commented out, or no output is returned, this is a finding.
Fix Text Configure the SSH daemon to not allow authentication using known hosts authentication. Add the following line in "/etc/ssh/sshd_config", or uncomment the line and set the value to "yes": IgnoreUserKnownHosts yes The SSH service must be restarted for changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72249" do title "The Red Hat Enterprise Linux operating system must be configured so that the SSH daemon does not allow authentication using known hosts authentication." desc "Configuring this setting for the SSH daemon provides additional assurance that remote logon via SSH will require a password, even in the event of misconfiguration elsewhere." desc "rationale", "" desc "check", " Verify the SSH daemon does not allow authentication using known hosts authentication. To determine how the SSH daemon's \"IgnoreUserKnownHosts\" option is set, run the following command: # grep -i IgnoreUserKnownHosts /etc/ssh/sshd_config IgnoreUserKnownHosts yes If the value is returned as \"no\", the returned line is commented out, or no output is returned, this is a finding. " desc "fix", " Configure the SSH daemon to not allow authentication using known hosts authentication. Add the following line in \"/etc/ssh/sshd_config\", or uncomment the line and set the value to \"yes\": IgnoreUserKnownHosts yes The SSH service must be restarted for changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72249" tag rid: "SV-86873r3_rule" tag stig_id: "RHEL-07-040380" tag fix_id: "F-78603r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe sshd_config do its('IgnoreUserKnownHosts') { should cmp 'yes' } end end
Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. "pwquality" enforces complex password construction configuration and has the ability to limit brute-force attacks on the system.
Test Results

Status passed
Test PAM Config[/etc/pam.d/passwd] lines is expected to include password (required|requisite) pam_pwquality.so
Result
Status passed
Test PAM Config[/etc/pam.d/passwd] lines is expected to include password (required|requisite) pam_pwquality.so, all with arg retry >= 1
Result
Status passed
Test PAM Config[/etc/pam.d/passwd] lines is expected to include password (required|requisite) pam_pwquality.so, all with arg retry <= 3
Result
Result Details

Control V-73159
Title The Red Hat Enterprise Linux operating system must be configured so that when passwords are changed or new passwords are established, pwquality must be used.
Desc Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. "pwquality" enforces complex password construction configuration and has the ability to limit brute-force attacks on the system.
Severity medium
Impact 0.5
Nist Controls IA-5 (1) (a), Rev_4
Check Text Verify the operating system uses "pwquality" to enforce the password complexity rules. Check for the use of "pwquality" with the following command: # cat /etc/pam.d/system-auth | grep pam_pwquality password required pam_pwquality.so retry=3 If the command does not return an uncommented line containing the value "pam_pwquality.so", this is a finding. If the value of "retry" is set to "0" or greater than "3", this is a finding.
Fix Text Configure the operating system to use "pwquality" to enforce password complexity rules. Add the following line to "/etc/pam.d/system-auth" (or modify the line to have the required value): password required pam_pwquality.so retry=3 Note: The value of "retry" should be between "1" and "3".

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-73159" do title "The Red Hat Enterprise Linux operating system must be configured so that when passwords are changed or new passwords are established, pwquality must be used." desc "Use of a complex password helps to increase the time and resources required to compromise the password. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. \"pwquality\" enforces complex password construction configuration and has the ability to limit brute-force attacks on the system." desc "rationale", "" desc "check", " Verify the operating system uses \"pwquality\" to enforce the password complexity rules. Check for the use of \"pwquality\" with the following command: # cat /etc/pam.d/system-auth | grep pam_pwquality password required pam_pwquality.so retry=3 If the command does not return an uncommented line containing the value \"pam_pwquality.so\", this is a finding. If the value of \"retry\" is set to \"0\" or greater than \"3\", this is a finding. " desc "fix", " Configure the operating system to use \"pwquality\" to enforce password complexity rules. Add the following line to \"/etc/pam.d/system-auth\" (or modify the line to have the required value): password required pam_pwquality.so retry=3 Note: The value of \"retry\" should be between \"1\" and \"3\". " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000069-GPOS-00037" tag gid: "V-73159" tag rid: "SV-87811r4_rule" tag stig_id: "RHEL-07-010119" tag fix_id: "F-79605r5_fix" tag cci: ["CCI-000192"] tag nist: ["IA-5 (1) (a)", "Rev_4"] max_retry = input('max_retry') describe pam('/etc/pam.d/passwd') do its('lines') { should match_pam_rule('password (required|requisite) pam_pwquality.so') } its('lines') { should match_pam_rule('password (required|requisite) pam_pwquality.so').all_with_integer_arg('retry', '>=', 1) } its('lines') { should match_pam_rule('password (required|requisite) pam_pwquality.so').all_with_integer_arg('retry', '<=', max_retry) } end end
Kernel core dumps may contain the full contents of system memory at the time of the crash. Kernel core dumps may consume a considerable amount of disk space and may result in denial of service by exhausting the available space on the target file system partition.
Test Results

Status passed
Test Service kdump.service is expected not to be running
Result
Result Details

Control V-72057
Title The Red Hat Enterprise Linux operating system must disable Kernel core dumps unless needed.
Desc Kernel core dumps may contain the full contents of system memory at the time of the crash. Kernel core dumps may consume a considerable amount of disk space and may result in denial of service by exhausting the available space on the target file system partition.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify that kernel core dumps are disabled unless needed. Check the status of the "kdump" service with the following command: # systemctl status kdump.service kdump.service - Crash recovery kernel arming Loaded: loaded (/usr/lib/systemd/system/kdump.service; enabled) Active: active (exited) since Wed 2015-08-26 13:08:09 EDT; 43min ago Main PID: 1130 (code=exited, status=0/SUCCESS) kernel arming. If the "kdump" service is active, ask the System Administrator if the use of the service is required and documented with the Information System Security Officer (ISSO). If the service is active and is not documented, this is a finding.
Fix Text If kernel core dumps are not required, disable the "kdump" service with the following command: # systemctl disable kdump.service If kernel core dumps are required, document the need with the ISSO.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72057" do title "The Red Hat Enterprise Linux operating system must disable Kernel core dumps unless needed." desc "Kernel core dumps may contain the full contents of system memory at the time of the crash. Kernel core dumps may consume a considerable amount of disk space and may result in denial of service by exhausting the available space on the target file system partition." desc "rationale", "" desc "check", " Verify that kernel core dumps are disabled unless needed. Check the status of the \"kdump\" service with the following command: # systemctl status kdump.service kdump.service - Crash recovery kernel arming Loaded: loaded (/usr/lib/systemd/system/kdump.service; enabled) Active: active (exited) since Wed 2015-08-26 13:08:09 EDT; 43min ago Main PID: 1130 (code=exited, status=0/SUCCESS) kernel arming. If the \"kdump\" service is active, ask the System Administrator if the use of the service is required and documented with the Information System Security Officer (ISSO). If the service is active and is not documented, this is a finding. " desc "fix", " If kernel core dumps are not required, disable the \"kdump\" service with the following command: # systemctl disable kdump.service If kernel core dumps are required, document the need with the ISSO. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72057" tag rid: "SV-86681r2_rule" tag stig_id: "RHEL-07-021300" tag fix_id: "F-78409r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe systemd_service('kdump.service') do it { should_not be_running } end end
If security personnel are not notified immediately when storage volume reaches 75 percent utilization, they are unable to plan for audit record storage capacity expansion.
Test Results

Status passed
Test Audit Daemon Config space_left.to_i is expected to be >= 7676
Result
Result Details

Control V-72089
Title The Red Hat Enterprise Linux operating system must initiate an action to notify the System Administrator (SA) and Information System Security Officer ISSO, at a minimum, when allocated audit record storage volume reaches 75% of the repository maximum audit record storage capacity.
Desc If security personnel are not notified immediately when storage volume reaches 75 percent utilization, they are unable to plan for audit record storage capacity expansion.
Severity medium
Impact 0.5
Nist Controls AU-5 (1), Rev_4
Check Text Verify the operating system initiates an action to notify the SA and ISSO (at a minimum) when allocated audit record storage volume reaches 75 percent of the repository maximum audit record storage capacity. Check the system configuration to determine the partition the audit records are being written to with the following command: # grep -iw log_file /etc/audit/auditd.conf log_file = /var/log/audit/audit.log Check the size of the partition that audit records are written to (with the example being "/var/log/audit/"): # df -h /var/log/audit/ 0.9G /var/log/audit If the audit records are not being written to a partition specifically created for audit records (in this example "/var/log/audit" is a separate partition), determine the amount of space other files in the partition are currently occupying with the following command: # du -sh <partition> 1.8G /var Determine what the threshold is for the system to take action when 75 percent of the repository maximum audit record storage capacity is reached: # grep -iw space_left /etc/audit/auditd.conf space_left = 225 If the value of the "space_left" keyword is not set to 25 percent of the total partition size, this is a finding.
Fix Text Configure the operating system to initiate an action to notify the SA and ISSO (at a minimum) when allocated audit record storage volume reaches 75 percent of the repository maximum audit record storage capacity. Check the system configuration to determine the partition the audit records are being written to: # grep -iw log_file /etc/audit/auditd.conf Determine the size of the partition that audit records are written to (with the example being "/var/log/audit/"): # df -h /var/log/audit/ Set the value of the "space_left" keyword in "/etc/audit/auditd.conf" to 25 percent of the partition size.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72089" do title "The Red Hat Enterprise Linux operating system must initiate an action to notify the System Administrator (SA) and Information System Security Officer ISSO, at a minimum, when allocated audit record storage volume reaches 75% of the repository maximum audit record storage capacity." desc "If security personnel are not notified immediately when storage volume reaches 75 percent utilization, they are unable to plan for audit record storage capacity expansion." desc "rationale", "" desc "check", " Verify the operating system initiates an action to notify the SA and ISSO (at a minimum) when allocated audit record storage volume reaches 75 percent of the repository maximum audit record storage capacity. Check the system configuration to determine the partition the audit records are being written to with the following command: # grep -iw log_file /etc/audit/auditd.conf log_file = /var/log/audit/audit.log Check the size of the partition that audit records are written to (with the example being \"/var/log/audit/\"): # df -h /var/log/audit/ 0.9G /var/log/audit If the audit records are not being written to a partition specifically created for audit records (in this example \"/var/log/audit\" is a separate partition), determine the amount of space other files in the partition are currently occupying with the following command: # du -sh <partition> 1.8G /var Determine what the threshold is for the system to take action when 75 percent of the repository maximum audit record storage capacity is reached: # grep -iw space_left /etc/audit/auditd.conf space_left = 225 If the value of the \"space_left\" keyword is not set to 25 percent of the total partition size, this is a finding. " desc "fix", " Configure the operating system to initiate an action to notify the SA and ISSO (at a minimum) when allocated audit record storage volume reaches 75 percent of the repository maximum audit record storage capacity. Check the system configuration to determine the partition the audit records are being written to: # grep -iw log_file /etc/audit/auditd.conf Determine the size of the partition that audit records are written to (with the example being \"/var/log/audit/\"): # df -h /var/log/audit/ Set the value of the \"space_left\" keyword in \"/etc/audit/auditd.conf\" to 25 percent of the partition size. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000343-GPOS-00134" tag gid: "V-72089" tag rid: "SV-86713r4_rule" tag stig_id: "RHEL-07-030330" tag fix_id: "F-78441r3_fix" tag cci: ["CCI-001855"] tag nist: ["AU-5 (1)", "Rev_4"] if((f = file(audit_log_dir = command("dirname #{auditd_conf.log_file}").stdout.strip)).directory?) # Fetch partition sizes in 1K blocks for consistency partition_info = command("df -B 1K #{audit_log_dir}").stdout.split("\n") partition_sz_arr = partition_info.last.gsub(/\s+/m, ' ').strip.split(" ") # Get partition size partition_sz = partition_sz_arr[1] # Convert to MB and get 25% exp_space_left = partition_sz.to_i / 1024 / 4 describe auditd_conf do its('space_left.to_i') { should be >= exp_space_left } end else describe f.directory? do it { should be true } end end end
If the systems access control program is not configured with appropriate rules for allowing and denying access to system network resources, services may be accessible to unauthorized hosts.
Test Results

Status passed
Test Firewall Rules with services is expected to be in
Result
Result Details

Control V-72315
Title The Red Hat Enterprise Linux operating system access control program must be configured to grant or deny system access to specific hosts and services.
Desc If the systems access control program is not configured with appropriate rules for allowing and denying access to system network resources, services may be accessible to unauthorized hosts.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text If the "firewalld" package is not installed, ask the System Administrator (SA) if another firewall application (such as iptables) is installed. If an application firewall is not installed, this is a finding. Verify the system's access control program is configured to grant or deny system access to specific hosts. Check to see if "firewalld" is active with the following command: # systemctl status firewalld firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled) Active: active (running) since Sun 2014-04-20 14:06:46 BST; 30s ago If "firewalld" is active, check to see if it is configured to grant or deny access to specific hosts or services with the following commands: # firewall-cmd --get-default-zone public # firewall-cmd --list-all --zone=public public (active) target: default icmp-block-inversion: no interfaces: eth0 sources: services: mdns ssh ports: protocols: masquerade: no forward-ports: icmp-blocks: If "firewalld" is not active, determine whether "tcpwrappers" is being used by checking whether the "hosts.allow" and "hosts.deny" files are empty with the following commands: # ls -al /etc/hosts.allow rw-r----- 1 root root 9 Aug 2 23:13 /etc/hosts.allow # ls -al /etc/hosts.deny -rw-r----- 1 root root 9 Apr 9 2007 /etc/hosts.deny If "firewalld" and "tcpwrappers" are not installed, configured, and active, ask the SA if another access control program (such as iptables) is installed and active. Ask the SA to show that the running configuration grants or denies access to specific hosts or services. If "firewalld" is active and is not configured to grant access to specific hosts or "tcpwrappers" is not configured to grant or deny access to specific hosts, this is a finding.
Fix Text If "firewalld" is installed and active on the system, configure rules for allowing specific services and hosts. If "firewalld" is not "active", enable "tcpwrappers" by configuring "/etc/hosts.allow" and "/etc/hosts.deny" to allow or deny access to specific hosts.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72315" do title "The Red Hat Enterprise Linux operating system access control program must be configured to grant or deny system access to specific hosts and services." desc "If the systems access control program is not configured with appropriate rules for allowing and denying access to system network resources, services may be accessible to unauthorized hosts." desc "rationale", "" desc "check", " If the \"firewalld\" package is not installed, ask the System Administrator (SA) if another firewall application (such as iptables) is installed. If an application firewall is not installed, this is a finding. Verify the system's access control program is configured to grant or deny system access to specific hosts. Check to see if \"firewalld\" is active with the following command: # systemctl status firewalld firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled) Active: active (running) since Sun 2014-04-20 14:06:46 BST; 30s ago If \"firewalld\" is active, check to see if it is configured to grant or deny access to specific hosts or services with the following commands: # firewall-cmd --get-default-zone public # firewall-cmd --list-all --zone=public public (active) target: default icmp-block-inversion: no interfaces: eth0 sources: services: mdns ssh ports: protocols: masquerade: no forward-ports: icmp-blocks: If \"firewalld\" is not active, determine whether \"tcpwrappers\" is being used by checking whether the \"hosts.allow\" and \"hosts.deny\" files are empty with the following commands: # ls -al /etc/hosts.allow rw-r----- 1 root root 9 Aug 2 23:13 /etc/hosts.allow # ls -al /etc/hosts.deny -rw-r----- 1 root root 9 Apr 9 2007 /etc/hosts.deny If \"firewalld\" and \"tcpwrappers\" are not installed, configured, and active, ask the SA if another access control program (such as iptables) is installed and active. Ask the SA to show that the running configuration grants or denies access to specific hosts or services. If \"firewalld\" is active and is not configured to grant access to specific hosts or \"tcpwrappers\" is not configured to grant or deny access to specific hosts, this is a finding. " desc "fix", " If \"firewalld\" is installed and active on the system, configure rules for allowing specific services and hosts. If \"firewalld\" is not \"active\", enable \"tcpwrappers\" by configuring \"/etc/hosts.allow\" and \"/etc/hosts.deny\" to allow or deny access to specific hosts. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72315" tag rid: "SV-86939r3_rule" tag stig_id: "RHEL-07-040810" tag fix_id: "F-78669r3_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] firewalld_services = input('firewalld_services') firewalld_hosts_allow = input('firewalld_hosts_allow') firewalld_hosts_deny = input('firewalld_hosts_deny') firewalld_ports_allow = input('firewalld_ports_allow') firewalld_ports_deny = input('firewalld_ports_deny') tcpwrappers_allow = input('tcpwrappers_allow') tcpwrappers_deny = input('tcpwrappers_deny') iptable_rules = input('iptables_rules') if service('firewalld').running? @default_zone = firewalld.default_zone describe firewalld.where{ zone = @default_zone } do its('services') { should be_in firewalld_services } end describe firewalld do firewalld_hosts_allow.each do |rule| it { should have_rule_enabled(rule) } end firewalld_hosts_deny.each do |rule| it { should_not have_rule_enabled(rule) } end firewalld_ports_allow.each do |port| it { should have_port_enabled_in_zone(port) } end firewalld_ports_deny.each do |port| it { should_not have_port_enabled_in_zone(port) } end end elsif service('iptables').running? describe iptables do iptable_rules.each do |rule| it { should have_rule(rule) } end end else describe package('tcp_wrappers') do it { should be_installed } end tcpwrappers_allow.each do |rule| describe etc_hosts_allow.where { daemon == rule['daemon'] } do its('client_list') { should be rule['client_list'] } its('options') { should be rule['options'] } end end tcpwrappers_deny.each do |rule| describe etc_hosts_deny.where { daemon == rule['daemon'] } do its('client_list') { should be rule['client_list'] } its('options') { should be rule['options'] } end end end end
When an NFS server is configured to use RPCSEC_SYS, a selected userid and groupid are used to handle requests from the remote user. The userid and groupid could mistakenly or maliciously be set incorrectly. The RPCSEC_GSS method of authentication uses certificates on the server and client systems to more securely authenticate the remote mount request.
Test Results

Status passed
Test No NFS file systems were found. is expected to eq true
Result
Result Details

Control V-72311
Title The Red Hat Enterprise Linux operating system must be configured so that the Network File System (NFS) is configured to use RPCSEC_GSS.
Desc When an NFS server is configured to use RPCSEC_SYS, a selected userid and groupid are used to handle requests from the remote user. The userid and groupid could mistakenly or maliciously be set incorrectly. The RPCSEC_GSS method of authentication uses certificates on the server and client systems to more securely authenticate the remote mount request.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify "AUTH_GSS" is being used to authenticate NFS mounts. To check if the system is importing an NFS file system, look for any entries in the "/etc/fstab" file that have a file system type of "nfs" with the following command: # cat /etc/fstab | grep nfs 192.168.21.5:/mnt/export /data1 nfs4 rw,sync ,soft,sec=krb5:krb5i:krb5p If the system is mounting file systems via NFS and has the sec option without the "krb5:krb5i:krb5p" settings, the "sec" option has the "sys" setting, or the "sec" option is missing, this is a finding.
Fix Text Update the "/etc/fstab" file so the option "sec" is defined for each NFS mounted file system and the "sec" option does not have the "sys" setting. Ensure the "sec" option is defined as "krb5:krb5i:krb5p".

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72311" do title "The Red Hat Enterprise Linux operating system must be configured so that the Network File System (NFS) is configured to use RPCSEC_GSS." desc "When an NFS server is configured to use RPCSEC_SYS, a selected userid and groupid are used to handle requests from the remote user. The userid and groupid could mistakenly or maliciously be set incorrectly. The RPCSEC_GSS method of authentication uses certificates on the server and client systems to more securely authenticate the remote mount request." desc "rationale", "" desc "check", " Verify \"AUTH_GSS\" is being used to authenticate NFS mounts. To check if the system is importing an NFS file system, look for any entries in the \"/etc/fstab\" file that have a file system type of \"nfs\" with the following command: # cat /etc/fstab | grep nfs 192.168.21.5:/mnt/export /data1 nfs4 rw,sync ,soft,sec=krb5:krb5i:krb5p If the system is mounting file systems via NFS and has the sec option without the \"krb5:krb5i:krb5p\" settings, the \"sec\" option has the \"sys\" setting, or the \"sec\" option is missing, this is a finding. " desc "fix", " Update the \"/etc/fstab\" file so the option \"sec\" is defined for each NFS mounted file system and the \"sec\" option does not have the \"sys\" setting. Ensure the \"sec\" option is defined as \"krb5:krb5i:krb5p\". " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72311" tag rid: "SV-86935r4_rule" tag stig_id: "RHEL-07-040750" tag fix_id: "F-78665r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] nfs_systems = etc_fstab.nfs_file_systems.entries if !nfs_systems.nil? and !nfs_systems.empty? nfs_systems.each do |file_system| describe file_system do its ('mount_options') { should include 'sec=krb5:krb5i:krb5p' } end end else describe "No NFS file systems were found." do subject { nfs_systems.nil? or nfs_systems.empty? } it { should eq true } end end end
Unauthorized changes to the baseline configuration could make the system vulnerable to various attacks or allow unauthorized access to the operating system. Changes to operating system configurations can have unintended side effects, some of which may be relevant to security. Detecting such changes and providing an automated response can help avoid unintended, negative consequences that could ultimately affect the security state of the operating system. The operating system's Information Management Officer (IMO)/Information System Security Officer (ISSO) and System Administrators (SAs) must be notified via email and/or monitoring system trap when there is an unauthorized modification of a configuration item.
Test Results

Status passed
Test System Package aide is expected to be installed
Result
Status passed
Test File /etc/cron.daily/aide content is expected to match /\/bin\/mail/
Result
Result Details

Control V-71975
Title The Red Hat Enterprise Linux operating system must be configured so that designated personnel are notified if baseline configurations are changed in an unauthorized manner.
Desc Unauthorized changes to the baseline configuration could make the system vulnerable to various attacks or allow unauthorized access to the operating system. Changes to operating system configurations can have unintended side effects, some of which may be relevant to security. Detecting such changes and providing an automated response can help avoid unintended, negative consequences that could ultimately affect the security state of the operating system. The operating system's Information Management Officer (IMO)/Information System Security Officer (ISSO) and System Administrators (SAs) must be notified via email and/or monitoring system trap when there is an unauthorized modification of a configuration item.
Severity medium
Impact 0.5
Nist Controls CM-3 (5), Rev_4
Check Text Verify the operating system notifies designated personnel if baseline configurations are changed in an unauthorized manner. Note: A file integrity tool other than Advanced Intrusion Detection Environment (AIDE) may be used, but the tool must be executed and notify specified individuals via email or an alert. Check to see if AIDE is installed on the system with the following command: # yum list installed aide If AIDE is not installed, ask the SA how file integrity checks are performed on the system. Check for the presence of a cron job running routinely on the system that executes AIDE to scan for changes to the system baseline. The commands used in the example will use a daily occurrence. Check the cron directories for a "crontab" script file controlling the execution of the file integrity application. For example, if AIDE is installed on the system, use the following command: # ls -al /etc/cron.* | grep aide -rwxr-xr-x 1 root root 32 Jul 1 2011 aide # grep aide /etc/crontab /var/spool/cron/root /etc/crontab: 30 04 * * * /root/aide /var/spool/cron/root: 30 04 * * * /root/aide AIDE does not have a configuration that will send a notification, so the cron job uses the mail application on the system to email the results of the file integrity run as in the following example: # more /etc/cron.daily/aide #!/bin/bash /usr/sbin/aide --check | /bin/mail -s "$HOSTNAME - Daily aide integrity check run" root@sysname.mil If the file integrity application does not notify designated personnel of changes, this is a finding.
Fix Text Configure the operating system to notify designated personnel if baseline configurations are changed in an unauthorized manner. The AIDE tool can be configured to email designated personnel with the use of the cron system. The following example output is generic. It will set cron to run AIDE daily and to send email at the completion of the analysis. # more /etc/cron.daily/aide /usr/sbin/aide --check | /bin/mail -s "$HOSTNAME - Daily aide integrity check run" root@sysname.mil

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71975" do title "The Red Hat Enterprise Linux operating system must be configured so that designated personnel are notified if baseline configurations are changed in an unauthorized manner." desc "Unauthorized changes to the baseline configuration could make the system vulnerable to various attacks or allow unauthorized access to the operating system. Changes to operating system configurations can have unintended side effects, some of which may be relevant to security. Detecting such changes and providing an automated response can help avoid unintended, negative consequences that could ultimately affect the security state of the operating system. The operating system's Information Management Officer (IMO)/Information System Security Officer (ISSO) and System Administrators (SAs) must be notified via email and/or monitoring system trap when there is an unauthorized modification of a configuration item. " desc "rationale", "" desc "check", " Verify the operating system notifies designated personnel if baseline configurations are changed in an unauthorized manner. Note: A file integrity tool other than Advanced Intrusion Detection Environment (AIDE) may be used, but the tool must be executed and notify specified individuals via email or an alert. Check to see if AIDE is installed on the system with the following command: # yum list installed aide If AIDE is not installed, ask the SA how file integrity checks are performed on the system. Check for the presence of a cron job running routinely on the system that executes AIDE to scan for changes to the system baseline. The commands used in the example will use a daily occurrence. Check the cron directories for a \"crontab\" script file controlling the execution of the file integrity application. For example, if AIDE is installed on the system, use the following command: # ls -al /etc/cron.* | grep aide -rwxr-xr-x 1 root root 32 Jul 1 2011 aide # grep aide /etc/crontab /var/spool/cron/root /etc/crontab: 30 04 * * * /root/aide /var/spool/cron/root: 30 04 * * * /root/aide AIDE does not have a configuration that will send a notification, so the cron job uses the mail application on the system to email the results of the file integrity run as in the following example: # more /etc/cron.daily/aide #!/bin/bash /usr/sbin/aide --check | /bin/mail -s \"$HOSTNAME - Daily aide integrity check run\" root@sysname.mil If the file integrity application does not notify designated personnel of changes, this is a finding. " desc "fix", " Configure the operating system to notify designated personnel if baseline configurations are changed in an unauthorized manner. The AIDE tool can be configured to email designated personnel with the use of the cron system. The following example output is generic. It will set cron to run AIDE daily and to send email at the completion of the analysis. # more /etc/cron.daily/aide /usr/sbin/aide --check | /bin/mail -s \"$HOSTNAME - Daily aide integrity check run\" root@sysname.mil " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000363-GPOS-00150" tag gid: "V-71975" tag rid: "SV-86599r2_rule" tag stig_id: "RHEL-07-020040" tag fix_id: "F-78327r3_fix" tag cci: ["CCI-001744"] tag nist: ["CM-3 (5)", "Rev_4"] file_integrity_tool = input('file_integrity_tool') describe package(file_integrity_tool) do it { should be_installed } end describe.one do describe file("/etc/cron.daily/#{file_integrity_tool}") do its('content') { should match %r{/bin/mail} } end describe file("/etc/cron.weekly/#{file_integrity_tool}") do its('content') { should match %r{/bin/mail} } end describe crontab('root').where { command =~ %r{#{file_integrity_tool}} } do its('commands.flatten') { should include(match %r{/bin/mail}) } end if file("/etc/cron.d/#{file_integrity_tool}").exist? describe crontab(path: "/etc/cron.d/#{file_integrity_tool}") do its('commands') { should include(match %r{/bin/mail}) } end end end end
USB mass storage permits easy introduction of unknown devices, thereby facilitating malicious activity.
Test Results

Status passed
Test Kernel Module usb_storage is expected not to be loaded
Result
Status passed
Test Kernel Module usb_storage is expected to be blacklisted
Result
Result Details

Control V-71983
Title The Red Hat Enterprise Linux operating system must be configured to disable USB mass storage.
Desc USB mass storage permits easy introduction of unknown devices, thereby facilitating malicious activity.
Severity medium
Impact 0.5
Nist Controls CM-6 b, IA-3, IA-3, Rev_4
Check Text If there is an HBSS with a Device Control Module and a Data Loss Prevention mechanism, this requirement is not applicable. Verify the operating system disables the ability to load the USB Storage kernel module. # grep -r usb-storage /etc/modprobe.d/* | grep -i "/bin/true" | grep -v "^#" install usb-storage /bin/true If the command does not return any output, or the line is commented out, and use of USB Storage is not documented with the Information System Security Officer (ISSO) as an operational requirement, this is a finding. Verify the operating system disables the ability to use USB mass storage devices. Check to see if USB mass storage is disabled with the following command: # grep usb-storage /etc/modprobe.d/* | grep -i "blacklist" | grep -v "^#" blacklist usb-storage If the command does not return any output or the output is not "blacklist usb-storage", and use of USB storage devices is not documented with the Information System Security Officer (ISSO) as an operational requirement, this is a finding.
Fix Text Configure the operating system to disable the ability to use the USB Storage kernel module. Create a file under "/etc/modprobe.d" with the following command: # touch /etc/modprobe.d/usb-storage.conf Add the following line to the created file: install usb-storage /bin/true Configure the operating system to disable the ability to use USB mass storage devices. # vi /etc/modprobe.d/blacklist.conf Add or update the line: blacklist usb-storage

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71983" do title "The Red Hat Enterprise Linux operating system must be configured to disable USB mass storage." desc "USB mass storage permits easy introduction of unknown devices, thereby facilitating malicious activity. " desc "rationale", "" desc "check", " If there is an HBSS with a Device Control Module and a Data Loss Prevention mechanism, this requirement is not applicable. Verify the operating system disables the ability to load the USB Storage kernel module. # grep -r usb-storage /etc/modprobe.d/* | grep -i \"/bin/true\" | grep -v \"^#\" install usb-storage /bin/true If the command does not return any output, or the line is commented out, and use of USB Storage is not documented with the Information System Security Officer (ISSO) as an operational requirement, this is a finding. Verify the operating system disables the ability to use USB mass storage devices. Check to see if USB mass storage is disabled with the following command: # grep usb-storage /etc/modprobe.d/* | grep -i \"blacklist\" | grep -v \"^#\" blacklist usb-storage If the command does not return any output or the output is not \"blacklist usb-storage\", and use of USB storage devices is not documented with the Information System Security Officer (ISSO) as an operational requirement, this is a finding. " desc "fix", " Configure the operating system to disable the ability to use the USB Storage kernel module. Create a file under \"/etc/modprobe.d\" with the following command: # touch /etc/modprobe.d/usb-storage.conf Add the following line to the created file: install usb-storage /bin/true Configure the operating system to disable the ability to use USB mass storage devices. # vi /etc/modprobe.d/blacklist.conf Add or update the line: blacklist usb-storage " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000114-GPOS-00059" tag satisfies: ["SRG-OS-000114-GPOS-00059", "SRG-OS-000378-GPOS-00163", "SRG-OS-000480-GPOS-00227"] tag gid: "V-71983" tag rid: "SV-86607r4_rule" tag stig_id: "RHEL-07-020100" tag fix_id: "F-78335r4_fix" tag cci: ["CCI-000366", "CCI-000778", "CCI-001958"] tag nist: ["CM-6 b", "IA-3", "IA-3", "Rev_4"] describe kernel_module('usb_storage') do it { should_not be_loaded } it { should be_blacklisted } end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with file == "/usr/sbin/semanage" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/usr/sbin/semanage" action is expected not to include "never"
Result
Status passed
Test ["x"] is expected to include "x"
Result
Result Details

Control V-72135
Title The Red Hat Enterprise Linux operating system must audit all uses of the semanage command.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "semanage" command occur. Check the file system rule in "/etc/audit/audit.rules" with the following command: # grep -i /usr/sbin/semanage /etc/audit/audit.rules -a always,exit -F path=/usr/sbin/semanage -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change If the command does not return any output, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "semanage" command occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules": -a always,exit -F path=/usr/sbin/semanage -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72135" do title "The Red Hat Enterprise Linux operating system must audit all uses of the semanage command." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"semanage\" command occur. Check the file system rule in \"/etc/audit/audit.rules\" with the following command: # grep -i /usr/sbin/semanage /etc/audit/audit.rules -a always,exit -F path=/usr/sbin/semanage -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change If the command does not return any output, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"semanage\" command occur. Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F path=/usr/sbin/semanage -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000392-GPOS-00172" tag satisfies: ["SRG-OS-000392-GPOS-00172", "SRG-OS-000463-GPOS-00207", "SRG-OS-000465-GPOS-00209"] tag gid: "V-72135" tag rid: "SV-86759r4_rule" tag stig_id: "RHEL-07-030560" tag fix_id: "F-78487r5_fix" tag cci: ["CCI-000172", "CCI-002884"] tag nist: ["AU-12 c", "MA-4 (1) (a)", "Rev_4"] audit_file = '/usr/sbin/semanage' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'x' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
ICMP redirect messages are used by routers to inform hosts that a more direct route exists for a particular destination. These messages contain information from the system's route table, possibly revealing portions of the network topology.
Test Results

Status passed
Test Kernel Parameter net.ipv4.conf.default.send_redirects value is expected to eq 0
Result
Result Details

Control V-72291
Title The Red Hat Enterprise Linux operating system must not allow interfaces to perform Internet Protocol version 4 (IPv4) Internet Control Message Protocol (ICMP) redirects by default.
Desc ICMP redirect messages are used by routers to inform hosts that a more direct route exists for a particular destination. These messages contain information from the system's route table, possibly revealing portions of the network topology.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the system does not allow interfaces to perform IPv4 ICMP redirects by default. # grep 'net.ipv4.conf.default.send_redirects' /etc/sysctl.conf /etc/sysctl.d/* If "net.ipv4.conf.default.send_redirects" is not configured in the "/etc/sysctl.conf" file or in the /etc/sysctl.d/ directory, is commented out or does not have a value of "0", this is a finding. Check that the operating system implements the "default send_redirects" variables with the following command: # /sbin/sysctl -a | grep 'net.ipv4.conf.default.send_redirects' net.ipv4.conf.default.send_redirects = 0 If the returned line does not have a value of "0", this is a finding.
Fix Text Configure the system to not allow interfaces to perform IPv4 ICMP redirects by default. Set the system to the required kernel parameter by adding the following line to "/etc/sysctl.conf" or a configuration file in the /etc/sysctl.d/ directory (or modify the line to have the required value): net.ipv4.conf.default.send_redirects = 0 Issue the following command to make the changes take effect: # sysctl --system

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72291" do title "The Red Hat Enterprise Linux operating system must not allow interfaces to perform Internet Protocol version 4 (IPv4) Internet Control Message Protocol (ICMP) redirects by default." desc "ICMP redirect messages are used by routers to inform hosts that a more direct route exists for a particular destination. These messages contain information from the system's route table, possibly revealing portions of the network topology." desc "rationale", "" desc "check", " Verify the system does not allow interfaces to perform IPv4 ICMP redirects by default. # grep 'net.ipv4.conf.default.send_redirects' /etc/sysctl.conf /etc/sysctl.d/* If \"net.ipv4.conf.default.send_redirects\" is not configured in the \"/etc/sysctl.conf\" file or in the /etc/sysctl.d/ directory, is commented out or does not have a value of \"0\", this is a finding. Check that the operating system implements the \"default send_redirects\" variables with the following command: # /sbin/sysctl -a | grep 'net.ipv4.conf.default.send_redirects' net.ipv4.conf.default.send_redirects = 0 If the returned line does not have a value of \"0\", this is a finding. " desc "fix", " Configure the system to not allow interfaces to perform IPv4 ICMP redirects by default. Set the system to the required kernel parameter by adding the following line to \"/etc/sysctl.conf\" or a configuration file in the /etc/sysctl.d/ directory (or modify the line to have the required value): net.ipv4.conf.default.send_redirects = 0 Issue the following command to make the changes take effect: # sysctl --system " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72291" tag rid: "SV-86915r4_rule" tag stig_id: "RHEL-07-040650" tag fix_id: "F-78645r4_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe kernel_parameter('net.ipv4.conf.default.send_redirects') do its('value') { should eq 0 } end end
If local interactive users do not own the files in their directories, unauthorized users may be able to access them. Additionally, if files are not owned by the user, this could be an indication of system compromise.
Test Results

Status passed
Test Files and directories that are not owned by the user is expected to be empty
Result
Result Details

Control V-72023
Title The Red Hat Enterprise Linux operating system must be configured so that all files and directories contained in local interactive user home directories are owned by the owner of the home directory.
Desc If local interactive users do not own the files in their directories, unauthorized users may be able to access them. Additionally, if files are not owned by the user, this could be an indication of system compromise.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify all files and directories in a local interactive user's home directory are owned by the user. Check the owner of all files and directories in a local interactive user's home directory with the following command: Note: The example will be for the user "smithj", who has a home directory of "/home/smithj". # ls -lLR /home/smithj -rw-r--r-- 1 smithj smithj 18 Mar 5 17:06 file1 -rw-r--r-- 1 smithj smithj 193 Mar 5 17:06 file2 -rw-r--r-- 1 smithj smithj 231 Mar 5 17:06 file3 If any files are found with an owner different than the home directory user, this is a finding.
Fix Text Change the owner of a local interactive user's files and directories to that owner. To change the owner of a local interactive user's files and directories, use the following command: Note: The example will be for the user smithj, who has a home directory of "/home/smithj". # chown smithj /home/smithj/<file or directory>

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72023" do title "The Red Hat Enterprise Linux operating system must be configured so that all files and directories contained in local interactive user home directories are owned by the owner of the home directory." desc "If local interactive users do not own the files in their directories, unauthorized users may be able to access them. Additionally, if files are not owned by the user, this could be an indication of system compromise." desc "rationale", "" desc "check", " Verify all files and directories in a local interactive user's home directory are owned by the user. Check the owner of all files and directories in a local interactive user's home directory with the following command: Note: The example will be for the user \"smithj\", who has a home directory of \"/home/smithj\". # ls -lLR /home/smithj -rw-r--r-- 1 smithj smithj 18 Mar 5 17:06 file1 -rw-r--r-- 1 smithj smithj 193 Mar 5 17:06 file2 -rw-r--r-- 1 smithj smithj 231 Mar 5 17:06 file3 If any files are found with an owner different than the home directory user, this is a finding. " desc "fix", " Change the owner of a local interactive user's files and directories to that owner. To change the owner of a local interactive user's files and directories, use the following command: Note: The example will be for the user smithj, who has a home directory of \"/home/smithj\". # chown smithj /home/smithj/<file or directory> " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72023" tag rid: "SV-86647r2_rule" tag stig_id: "RHEL-07-020660" tag fix_id: "F-78375r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] exempt_home_users = input('exempt_home_users') non_interactive_shells = input('non_interactive_shells') ignore_shells = non_interactive_shells.join('|') uid_min = login_defs.read_params['UID_MIN'].to_i uid_min = 1000 if uid_min.nil? findings = Set[] users.where{ !shell.match(ignore_shells) && (uid >= uid_min || uid == 0)}.entries.each do |user_info| next if exempt_home_users.include?("#{user_info.username}") findings = findings + command("find #{user_info.home} -xdev -xautofs -not -user #{user_info.username}").stdout.split("\n") end describe "Files and directories that are not owned by the user" do subject { findings.to_a } it { should be_empty } end end
Terminating an idle SSH session within a short time period reduces the window of opportunity for unauthorized personnel to take control of a management session enabled on the console or console port that has been left unattended. In addition, quickly terminating an idle SSH session will also free up resources committed by the managed network element. Terminating network connections associated with communications sessions includes, for example, de-allocating associated TCP/IP address/port pairs at the operating system level and de-allocating networking assignments at the application level if multiple application sessions are using a single operating system-level network connection. This does not mean that the operating system terminates all sessions or network access; it only ends the inactive session and releases the resources associated with that session.
Test Results

Status passed
Test SSHD Configuration ClientAliveInterval.to_i is expected to cmp >= 1
Result
Status passed
Test SSHD Configuration ClientAliveInterval.to_i is expected to cmp <= 600
Result
Status passed
Test SSHD Configuration ClientAliveInterval is expected not to eq nil
Result
Result Details

Control V-72237
Title The Red Hat Enterprise Linux operating system must be configured so that all network connections associated with SSH traffic are terminated at the end of the session or after 10 minutes of inactivity, except to fulfill documented and validated mission requirements.
Desc Terminating an idle SSH session within a short time period reduces the window of opportunity for unauthorized personnel to take control of a management session enabled on the console or console port that has been left unattended. In addition, quickly terminating an idle SSH session will also free up resources committed by the managed network element. Terminating network connections associated with communications sessions includes, for example, de-allocating associated TCP/IP address/port pairs at the operating system level and de-allocating networking assignments at the application level if multiple application sessions are using a single operating system-level network connection. This does not mean that the operating system terminates all sessions or network access; it only ends the inactive session and releases the resources associated with that session.
Severity medium
Impact 0.5
Nist Controls SC-10, AC-12, Rev_4
Check Text Verify the operating system automatically terminates a user session after inactivity time-outs have expired. Check for the value of the "ClientAliveInterval" keyword with the following command: # grep -iw clientaliveinterval /etc/ssh/sshd_config ClientAliveInterval 600 If "ClientAliveInterval" is not configured, commented out, or has a value of "0", this is a finding. If "ClientAliveInterval" has a value that is greater than "600" and is not documented with the Information System Security Officer (ISSO) as an operational requirement, this is a finding.
Fix Text Configure the operating system to automatically terminate a user session after inactivity time-outs have expired or at shutdown. Add the following line (or modify the line to have the required value) to the "/etc/ssh/sshd_config" file (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor): ClientAliveInterval 600 The SSH service must be restarted for changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72237" do title "The Red Hat Enterprise Linux operating system must be configured so that all network connections associated with SSH traffic are terminated at the end of the session or after 10 minutes of inactivity, except to fulfill documented and validated mission requirements." desc "Terminating an idle SSH session within a short time period reduces the window of opportunity for unauthorized personnel to take control of a management session enabled on the console or console port that has been left unattended. In addition, quickly terminating an idle SSH session will also free up resources committed by the managed network element. Terminating network connections associated with communications sessions includes, for example, de-allocating associated TCP/IP address/port pairs at the operating system level and de-allocating networking assignments at the application level if multiple application sessions are using a single operating system-level network connection. This does not mean that the operating system terminates all sessions or network access; it only ends the inactive session and releases the resources associated with that session. " desc "rationale", "" desc "check", " Verify the operating system automatically terminates a user session after inactivity time-outs have expired. Check for the value of the \"ClientAliveInterval\" keyword with the following command: # grep -iw clientaliveinterval /etc/ssh/sshd_config ClientAliveInterval 600 If \"ClientAliveInterval\" is not configured, commented out, or has a value of \"0\", this is a finding. If \"ClientAliveInterval\" has a value that is greater than \"600\" and is not documented with the Information System Security Officer (ISSO) as an operational requirement, this is a finding. " desc "fix", " Configure the operating system to automatically terminate a user session after inactivity time-outs have expired or at shutdown. Add the following line (or modify the line to have the required value) to the \"/etc/ssh/sshd_config\" file (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor): ClientAliveInterval 600 The SSH service must be restarted for changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000163-GPOS-00072" tag satisfies: ["SRG-OS-000163-GPOS-00072", "SRG-OS-000279-GPOS-00109"] tag gid: "V-72237" tag rid: "SV-86861r4_rule" tag stig_id: "RHEL-07-040320" tag fix_id: "F-78591r2_fix" tag cci: ["CCI-001133", "CCI-002361"] tag nist: ["SC-10", "AC-12", "Rev_4"] client_alive_interval = input('client_alive_interval') #This may show slightly confusing results when a ClientAliveInterValue is not #specified. Specifically, because the value will be nil and when you try to #convert it to an integer using to_i it will convert it to 0 and pass the #<= client_alive_interval check. However, the control as a whole will still fail. describe sshd_config do its("ClientAliveInterval.to_i"){should cmp >= 1} its("ClientAliveInterval.to_i"){should cmp <= client_alive_interval} its("ClientAliveInterval"){should_not eq nil} end end
Without verification of the security functions, security functions may not operate correctly and the failure may go unnoticed. Security function is defined as the hardware, software, and/or firmware of the information system responsible for enforcing the system security policy and supporting the isolation of code and data on which the protection is based. Security functionality includes, but is not limited to, establishing system accounts, configuring access authorizations (i.e., permissions, privileges), setting events to be audited, and setting intrusion detection parameters. This requirement applies to operating systems performing security function verification/testing and/or systems and environments that require this functionality.
Test Results

Status passed
Test Command: `getenforce` stdout.strip is expected to eq "Enforcing"
Result
Result Details

Control V-71989
Title The Red Hat Enterprise Linux operating system must enable SELinux.
Desc Without verification of the security functions, security functions may not operate correctly and the failure may go unnoticed. Security function is defined as the hardware, software, and/or firmware of the information system responsible for enforcing the system security policy and supporting the isolation of code and data on which the protection is based. Security functionality includes, but is not limited to, establishing system accounts, configuring access authorizations (i.e., permissions, privileges), setting events to be audited, and setting intrusion detection parameters. This requirement applies to operating systems performing security function verification/testing and/or systems and environments that require this functionality.
Severity high
Impact 0.7
Nist Controls AC-3 (4), SI-6 a, Rev_4
Check Text If an HBSS or HIPS is active on the system, this is Not Applicable. Verify the operating system verifies correct operation of all security functions. Check if "SELinux" is active and in "Enforcing" mode with the following command: # getenforce Enforcing If "SELinux" is not active and not in "Enforcing" mode, this is a finding.
Fix Text Configure the operating system to verify correct operation of all security functions. Set the "SELinux" status and the "Enforcing" mode by modifying the "/etc/selinux/config" file to have the following line: SELINUX=enforcing A reboot is required for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71989" do title "The Red Hat Enterprise Linux operating system must enable SELinux." desc "Without verification of the security functions, security functions may not operate correctly and the failure may go unnoticed. Security function is defined as the hardware, software, and/or firmware of the information system responsible for enforcing the system security policy and supporting the isolation of code and data on which the protection is based. Security functionality includes, but is not limited to, establishing system accounts, configuring access authorizations (i.e., permissions, privileges), setting events to be audited, and setting intrusion detection parameters. This requirement applies to operating systems performing security function verification/testing and/or systems and environments that require this functionality. " desc "rationale", "" desc "check", " If an HBSS or HIPS is active on the system, this is Not Applicable. Verify the operating system verifies correct operation of all security functions. Check if \"SELinux\" is active and in \"Enforcing\" mode with the following command: # getenforce Enforcing If \"SELinux\" is not active and not in \"Enforcing\" mode, this is a finding. " desc "fix", " Configure the operating system to verify correct operation of all security functions. Set the \"SELinux\" status and the \"Enforcing\" mode by modifying the \"/etc/selinux/config\" file to have the following line: SELINUX=enforcing A reboot is required for the changes to take effect. " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000445-GPOS-00199" tag gid: "V-71989" tag rid: "SV-86613r3_rule" tag stig_id: "RHEL-07-020210" tag fix_id: "F-78341r2_fix" tag cci: ["CCI-002165", "CCI-002696"] tag nist: ["AC-3 (4)", "SI-6 a", "Rev_4"] describe command('getenforce') do its('stdout.strip') { should eq 'Enforcing' } end end
Information stored in one location is vulnerable to accidental or incidental deletion or alteration. Off-loading is a common process in information systems with limited audit storage capacity. Without the configuration of the "au-remote" plugin, the audisp-remote daemon will not off-load the logs from the system being audited.
Test Results

Status skipped
Test File '/etc/audisp/plugins.d/au-remote.conf' cannot be found. This test cannot be checked in a automated fashion and you must check it manually
Result
Result Details

Control V-81015
Title The Red Hat Enterprise Linux operating system must be configured to use the au-remote plugin.
Desc Information stored in one location is vulnerable to accidental or incidental deletion or alteration. Off-loading is a common process in information systems with limited audit storage capacity. Without the configuration of the "au-remote" plugin, the audisp-remote daemon will not off-load the logs from the system being audited.
Severity medium
Impact 0.5
Nist Controls AU-4 (1), Rev_4
Check Text Verify the "au-remote" plugin is active on the system: # grep "active" /etc/audisp/plugins.d/au-remote.conf active = yes If the "active" setting is not set to "yes", or the line is commented out, this is a finding.
Fix Text Edit the /etc/audisp/plugins.d/au-remote.conf file and change the value of "active" to "yes". The audit daemon must be restarted for changes to take effect: # service auditd restart

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-81015" do title "The Red Hat Enterprise Linux operating system must be configured to use the au-remote plugin." desc "Information stored in one location is vulnerable to accidental or incidental deletion or alteration. Off-loading is a common process in information systems with limited audit storage capacity. Without the configuration of the \"au-remote\" plugin, the audisp-remote daemon will not off-load the logs from the system being audited. " desc "rationale", "" desc "check", " Verify the \"au-remote\" plugin is active on the system: # grep \"active\" /etc/audisp/plugins.d/au-remote.conf active = yes If the \"active\" setting is not set to \"yes\", or the line is commented out, this is a finding. " desc "fix", " Edit the /etc/audisp/plugins.d/au-remote.conf file and change the value of \"active\" to \"yes\". The audit daemon must be restarted for changes to take effect: # service auditd restart " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000342-GPOS-00133" tag satisfies: ["SRG-OS-000342-GPOS-00133", "SRG-OS-000479-GPOS-00224"] tag gid: "V-81015" tag rid: "SV-95727r1_rule" tag stig_id: "RHEL-07-030200" tag fix_id: "F-87849r2_fix" tag cci: ["CCI-001851"] tag nist: ["AU-4 (1)", "Rev_4"] test_file = '/etc/audisp/plugins.d/au-remote.conf' if file(test_file).exist? describe parse_config_file(test_file) do its('active') { should match %r{yes$} } end else describe "File '#{test_file}' cannot be found. This test cannot be checked in a automated fashion and you must check it manually" do skip "File '#{test_file}' cannot be found. This check must be performed manually" end end end
If a user is assigned the GID of a group not existing on the system, and a group with the GID is subsequently created, the user may have unintended rights to any files associated with the group.
Test Results

Status passed
Test /etc/group gids is expected to include 0
Result
Status passed
Test /etc/group gids is expected to include 1
Result
Status passed
Test /etc/group gids is expected to include 2
Result
Status passed
Test /etc/group gids is expected to include 4
Result
Status passed
Test /etc/group gids is expected to include 7
Result
Status passed
Test /etc/group gids is expected to include 0
Result
Status passed
Test /etc/group gids is expected to include 0
Result
Status passed
Test /etc/group gids is expected to include 0
Result
Status passed
Test /etc/group gids is expected to include 12
Result
Status passed
Test /etc/group gids is expected to include 0
Result
Status passed
Test /etc/group gids is expected to include 99
Result
Status passed
Test /etc/group gids is expected to include 192
Result
Status passed
Test /etc/group gids is expected to include 81
Result
Status passed
Test /etc/group gids is expected to include 998
Result
Status passed
Test /etc/group gids is expected to include 74
Result
Status passed
Test /etc/group gids is expected to include 89
Result
Status passed
Test /etc/group gids is expected to include 995
Result
Status passed
Test /etc/group gids is expected to include 1000
Result
Status passed
Test /etc/group gids is expected to include 59
Result
Status passed
Test /etc/group gids is expected to include 993
Result
Result Details

Control V-72003
Title The Red Hat Enterprise Linux operating system must be configured so that all Group Identifiers (GIDs) referenced in the /etc/passwd file are defined in the /etc/group file.
Desc If a user is assigned the GID of a group not existing on the system, and a group with the GID is subsequently created, the user may have unintended rights to any files associated with the group.
Severity low
Impact 0.3
Nist Controls IA-2, Rev_4
Check Text Verify all GIDs referenced in the "/etc/passwd" file are defined in the "/etc/group" file. Check that all referenced GIDs exist with the following command: # pwck -r If GIDs referenced in "/etc/passwd" file are returned as not defined in "/etc/group" file, this is a finding.
Fix Text Configure the system to define all GIDs found in the "/etc/passwd" file by modifying the "/etc/group" file to add any non-existent group referenced in the "/etc/passwd" file, or change the GIDs referenced in the "/etc/passwd" file to a group that exists in "/etc/group".

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72003" do title "The Red Hat Enterprise Linux operating system must be configured so that all Group Identifiers (GIDs) referenced in the /etc/passwd file are defined in the /etc/group file." desc "If a user is assigned the GID of a group not existing on the system, and a group with the GID is subsequently created, the user may have unintended rights to any files associated with the group." desc "rationale", "" desc "check", " Verify all GIDs referenced in the \"/etc/passwd\" file are defined in the \"/etc/group\" file. Check that all referenced GIDs exist with the following command: # pwck -r If GIDs referenced in \"/etc/passwd\" file are returned as not defined in \"/etc/group\" file, this is a finding. " desc "fix", "Configure the system to define all GIDs found in the \"/etc/passwd\" file by modifying the \"/etc/group\" file to add any non-existent group referenced in the \"/etc/passwd\" file, or change the GIDs referenced in the \"/etc/passwd\" file to a group that exists in \"/etc/group\"." impact 0.3 tag severity: nil tag gtitle: "SRG-OS-000104-GPOS-00051" tag gid: "V-72003" tag rid: "SV-86627r2_rule" tag stig_id: "RHEL-07-020300" tag fix_id: "F-78355r1_fix" tag cci: ["CCI-000764"] tag nist: ["IA-2", "Rev_4"] passwd.gids.each do |gid| describe etc_group do its('gids') { should include gid.to_i } end end end
Enabling reverse path filtering drops packets with source addresses that should not have been able to be received on the interface they were received on. It should not be used on systems which are routers for complicated networks, but is helpful for end hosts and routers serving small networks.
Test Results

Status passed
Test Kernel Parameter net.ipv4.conf.all.rp_filter value is expected to eq 1
Result
Result Details

Control V-92251
Title The Red Hat Enterprise Linux operating system must use a reverse-path filter for IPv4 network traffic when possible on all interfaces.
Desc Enabling reverse path filtering drops packets with source addresses that should not have been able to be received on the interface they were received on. It should not be used on systems which are routers for complicated networks, but is helpful for end hosts and routers serving small networks.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the system uses a reverse-path filter for IPv4: # grep net.ipv4.conf.all.rp_filter /etc/sysctl.conf /etc/sysctl.d/* net.ipv4.conf.all.rp_filter = 1 If "net.ipv4.conf.all.rp_filter" is not configured in the /etc/sysctl.conf file or in the /etc/sysctl.d/ directory, is commented out, or does not have a value of "1", this is a finding. Check that the operating system implements the accept source route variable with the following command: # /sbin/sysctl -a | grep net.ipv4.conf.all.rp_filter net.ipv4.conf.all.rp_filter = 1 If the returned line does not have a value of "1", this is a finding.
Fix Text Set the system to the required kernel parameter by adding the following line to "/etc/sysctl.conf" or a configuration file in the /etc/sysctl.d/ directory (or modify the line to have the required value): net.ipv4.conf.all.rp_filter = 1 Issue the following command to make the changes take effect: # sysctl --system

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-92251" do title "The Red Hat Enterprise Linux operating system must use a reverse-path filter for IPv4 network traffic when possible on all interfaces." desc "Enabling reverse path filtering drops packets with source addresses that should not have been able to be received on the interface they were received on. It should not be used on systems which are routers for complicated networks, but is helpful for end hosts and routers serving small networks." desc "rationale", "" desc "check", " Verify the system uses a reverse-path filter for IPv4: # grep net.ipv4.conf.all.rp_filter /etc/sysctl.conf /etc/sysctl.d/* net.ipv4.conf.all.rp_filter = 1 If \"net.ipv4.conf.all.rp_filter\" is not configured in the /etc/sysctl.conf file or in the /etc/sysctl.d/ directory, is commented out, or does not have a value of \"1\", this is a finding. Check that the operating system implements the accept source route variable with the following command: # /sbin/sysctl -a | grep net.ipv4.conf.all.rp_filter net.ipv4.conf.all.rp_filter = 1 If the returned line does not have a value of \"1\", this is a finding. " desc "fix", " Set the system to the required kernel parameter by adding the following line to \"/etc/sysctl.conf\" or a configuration file in the /etc/sysctl.d/ directory (or modify the line to have the required value): net.ipv4.conf.all.rp_filter = 1 Issue the following command to make the changes take effect: # sysctl --system " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-92251" tag rid: "SV-102353r1_rule" tag stig_id: "RHEL-07-040611" tag fix_id: "F-98473r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe kernel_parameter('net.ipv4.conf.all.rp_filter') do its('value') { should eq 1 } end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with syscall == "delete_module" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "delete_module" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "delete_module" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "delete_module" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Result Details

Control V-72189
Title The Red Hat Enterprise Linux operating system must audit all uses of the delete_module syscall.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-12 c, Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "delete_module" syscall occur. Check the auditing rules in "/etc/audit/audit.rules" with the following command: # grep -iw delete_module /etc/audit/audit.rules -a always,exit -F arch=b32 -S delete_module -k module-change -a always,exit -F arch=b64 -S delete_module -k module-change If both the "b32" and "b64" audit rules are not defined for the "delete_module" syscall, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "delete_module" syscall occur. Add or update the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S delete_module -k module-change -a always,exit -F arch=b64 -S delete_module -k module-change The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72189" do title "The Red Hat Enterprise Linux operating system must audit all uses of the delete_module syscall." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"delete_module\" syscall occur. Check the auditing rules in \"/etc/audit/audit.rules\" with the following command: # grep -iw delete_module /etc/audit/audit.rules -a always,exit -F arch=b32 -S delete_module -k module-change -a always,exit -F arch=b64 -S delete_module -k module-change If both the \"b32\" and \"b64\" audit rules are not defined for the \"delete_module\" syscall, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"delete_module\" syscall occur. Add or update the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S delete_module -k module-change -a always,exit -F arch=b64 -S delete_module -k module-change The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000471-GPOS-00216" tag satisfies: ["SRG-OS-000471-GPOS-00216", "SRG-OS-000477-GPOS-00222"] tag gid: "V-72189" tag rid: "SV-86813r5_rule" tag stig_id: "RHEL-07-030830" tag fix_id: "F-78543r7_fix" tag cci: ["CCI-000172"] tag nist: ["AU-12 c", "Rev_4"] describe auditd.syscall("delete_module").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end if os.arch == 'x86_64' describe auditd.syscall("delete_module").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end end end
ICMP redirect messages are used by routers to inform hosts that a more direct route exists for a particular destination. These messages modify the host's route table and are unauthenticated. An illicit ICMP redirect message could result in a man-in-the-middle attack.
Test Results

Status passed
Test Kernel Parameter net.ipv4.conf.all.accept_redirects value is expected to eq 0
Result
Result Details

Control V-73175
Title The Red Hat Enterprise Linux operating system must ignore Internet Protocol version 4 (IPv4) Internet Control Message Protocol (ICMP) redirect messages.
Desc ICMP redirect messages are used by routers to inform hosts that a more direct route exists for a particular destination. These messages modify the host's route table and are unauthenticated. An illicit ICMP redirect message could result in a man-in-the-middle attack.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the system ignores IPv4 ICMP redirect messages. # grep 'net.ipv4.conf.all.accept_redirects' /etc/sysctl.conf /etc/sysctl.d/* If " net.ipv4.conf.all.accept_redirects " is not configured in the /etc/sysctl.conf file or in the /etc/sysctl.d/ directory, is commented out, or does not have a value of "0", this is a finding. Check that the operating system implements the "accept_redirects" variables with the following command: # /sbin/sysctl -a | grep 'net.ipv4.conf.all.accept_redirects' net.ipv4.conf.all.accept_redirects = 0 If the returned line does not have a value of "0", this is a finding.
Fix Text Set the system to ignore IPv4 ICMP redirect messages by adding the following line to "/etc/sysctl.conf" or a configuration file in the /etc/sysctl.d/ directory (or modify the line to have the required value): net.ipv4.conf.all.accept_redirects = 0 Issue the following command to make the changes take effect: # sysctl --system

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-73175" do title "The Red Hat Enterprise Linux operating system must ignore Internet Protocol version 4 (IPv4) Internet Control Message Protocol (ICMP) redirect messages." desc "ICMP redirect messages are used by routers to inform hosts that a more direct route exists for a particular destination. These messages modify the host's route table and are unauthenticated. An illicit ICMP redirect message could result in a man-in-the-middle attack." desc "rationale", "" desc "check", " Verify the system ignores IPv4 ICMP redirect messages. # grep 'net.ipv4.conf.all.accept_redirects' /etc/sysctl.conf /etc/sysctl.d/* If \" net.ipv4.conf.all.accept_redirects \" is not configured in the /etc/sysctl.conf file or in the /etc/sysctl.d/ directory, is commented out, or does not have a value of \"0\", this is a finding. Check that the operating system implements the \"accept_redirects\" variables with the following command: # /sbin/sysctl -a | grep 'net.ipv4.conf.all.accept_redirects' net.ipv4.conf.all.accept_redirects = 0 If the returned line does not have a value of \"0\", this is a finding. " desc "fix", " Set the system to ignore IPv4 ICMP redirect messages by adding the following line to \"/etc/sysctl.conf\" or a configuration file in the /etc/sysctl.d/ directory (or modify the line to have the required value): net.ipv4.conf.all.accept_redirects = 0 Issue the following command to make the changes take effect: # sysctl --system " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-73175" tag rid: "SV-87827r4_rule" tag stig_id: "RHEL-07-040641" tag fix_id: "F-79621r3_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe kernel_parameter('net.ipv4.conf.all.accept_redirects') do its('value') { should eq 0 } end end
Kerberos authentication for SSH is often implemented using Generic Security Service Application Program Interface (GSSAPI). If Kerberos is enabled through SSH, the SSH daemon provides a means of access to the system's Kerberos implementation. Vulnerabilities in the system's Kerberos implementation may then be subject to exploitation. To reduce the attack surface of the system, the Kerberos authentication mechanism within SSH must be disabled for systems not using this capability.
Test Results

Status passed
Test SSHD Configuration KerberosAuthentication is expected to cmp == "no"
Result
Result Details

Control V-72261
Title The Red Hat Enterprise Linux operating system must be configured so that the SSH daemon does not permit Kerberos authentication unless needed.
Desc Kerberos authentication for SSH is often implemented using Generic Security Service Application Program Interface (GSSAPI). If Kerberos is enabled through SSH, the SSH daemon provides a means of access to the system's Kerberos implementation. Vulnerabilities in the system's Kerberos implementation may then be subject to exploitation. To reduce the attack surface of the system, the Kerberos authentication mechanism within SSH must be disabled for systems not using this capability.
Severity medium
Impact 0.5
Nist Controls CM-3 f, CM-6 c, CM-11 (2), CM-5 (1), CM-5 (1), Rev_4
Check Text Verify the SSH daemon does not permit Kerberos to authenticate passwords unless approved. Check that the SSH daemon does not permit Kerberos to authenticate passwords with the following command: # grep -i kerberosauth /etc/ssh/sshd_config KerberosAuthentication no If the "KerberosAuthentication" keyword is missing, or is set to "yes" and is not documented with the Information System Security Officer (ISSO), or the returned line is commented out, this is a finding.
Fix Text Uncomment the "KerberosAuthentication" keyword in "/etc/ssh/sshd_config" (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor) and set the value to "no": KerberosAuthentication no The SSH service must be restarted for changes to take effect. If Kerberos authentication is required, it must be documented, to include the location of the configuration file, with the ISSO.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72261" do title "The Red Hat Enterprise Linux operating system must be configured so that the SSH daemon does not permit Kerberos authentication unless needed." desc "Kerberos authentication for SSH is often implemented using Generic Security Service Application Program Interface (GSSAPI). If Kerberos is enabled through SSH, the SSH daemon provides a means of access to the system's Kerberos implementation. Vulnerabilities in the system's Kerberos implementation may then be subject to exploitation. To reduce the attack surface of the system, the Kerberos authentication mechanism within SSH must be disabled for systems not using this capability." desc "rationale", "" desc "check", " Verify the SSH daemon does not permit Kerberos to authenticate passwords unless approved. Check that the SSH daemon does not permit Kerberos to authenticate passwords with the following command: # grep -i kerberosauth /etc/ssh/sshd_config KerberosAuthentication no If the \"KerberosAuthentication\" keyword is missing, or is set to \"yes\" and is not documented with the Information System Security Officer (ISSO), or the returned line is commented out, this is a finding. " desc "fix", " Uncomment the \"KerberosAuthentication\" keyword in \"/etc/ssh/sshd_config\" (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor) and set the value to \"no\": KerberosAuthentication no The SSH service must be restarted for changes to take effect. If Kerberos authentication is required, it must be documented, to include the location of the configuration file, with the ISSO. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000364-GPOS-00151" tag gid: "V-72261" tag rid: "SV-86885r3_rule" tag stig_id: "RHEL-07-040440" tag fix_id: "F-78615r2_fix" tag cci: ["CCI-000318", "CCI-000368", "CCI-001812", "CCI-001813", "CCI-001814"] tag nist: ["CM-3 f", "CM-6 c", "CM-11 (2)", "CM-5 (1)", "CM-5 (1)", "Rev_4"] describe sshd_config do its('KerberosAuthentication') { should cmp 'no' } end end
Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged mount commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Test Results

Status passed
Test Auditd Rules with syscall == "mount" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "mount" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "mount" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "mount" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with path == "/usr/bin/mount" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with path == "/usr/bin/mount" list.uniq is expected to eq ["exit"]
Result
Result Details

Control V-72171
Title The Red Hat Enterprise Linux operating system must audit all uses of the mount command and syscall.
Desc Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged mount commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Severity medium
Impact 0.5
Nist Controls AU-3 (1), MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "mount" command and syscall occur. Check that the following system call is being audited by performing the following series of commands to check the file system rules in "/etc/audit/audit.rules": # grep -iw "mount" /etc/audit/audit.rules -a always,exit -F arch=b32 -S mount -F auid>=1000 -F auid!=4294967295 -k privileged-mount -a always,exit -F arch=b64 -S mount -F auid>=1000 -F auid!=4294967295 -k privileged-mount -a always,exit -F path=/usr/bin/mount -F auid>=1000 -F auid!=4294967295 -k privileged-mount If both the "b32" and "b64" audit rules are not defined for the "mount" syscall, this is a finding. If all uses of the "mount" command are not being audited, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "mount" command and syscall occur. Add or update the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S mount -F auid>=1000 -F auid!=4294967295 -k privileged-mount -a always,exit -F arch=b64 -S mount -F auid>=1000 -F auid!=4294967295 -k privileged-mount -a always,exit -F path=/usr/bin/mount -F auid>=1000 -F auid!=4294967295 -k privileged-mount The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72171" do title "The Red Hat Enterprise Linux operating system must audit all uses of the mount command and syscall." desc "Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged mount commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise. " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"mount\" command and syscall occur. Check that the following system call is being audited by performing the following series of commands to check the file system rules in \"/etc/audit/audit.rules\": # grep -iw \"mount\" /etc/audit/audit.rules -a always,exit -F arch=b32 -S mount -F auid>=1000 -F auid!=4294967295 -k privileged-mount -a always,exit -F arch=b64 -S mount -F auid>=1000 -F auid!=4294967295 -k privileged-mount -a always,exit -F path=/usr/bin/mount -F auid>=1000 -F auid!=4294967295 -k privileged-mount If both the \"b32\" and \"b64\" audit rules are not defined for the \"mount\" syscall, this is a finding. If all uses of the \"mount\" command are not being audited, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"mount\" command and syscall occur. Add or update the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S mount -F auid>=1000 -F auid!=4294967295 -k privileged-mount -a always,exit -F arch=b64 -S mount -F auid>=1000 -F auid!=4294967295 -k privileged-mount -a always,exit -F path=/usr/bin/mount -F auid>=1000 -F auid!=4294967295 -k privileged-mount The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000042-GPOS-00020" tag satisfies: ["SRG-OS-000042-GPOS-00020", "SRG-OS-000392-GPOS-00172"] tag gid: "V-72171" tag rid: "SV-86795r7_rule" tag stig_id: "RHEL-07-030740" tag fix_id: "F-78525r9_fix" tag cci: ["CCI-000135", "CCI-002884"] tag nist: ["AU-3 (1)", "MA-4 (1) (a)", "Rev_4"] describe auditd.syscall("mount").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end if os.arch == 'x86_64' describe auditd.syscall("mount").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end end describe auditd.path("/usr/bin/mount") do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end end
The "nosuid" mount option causes the system to not execute "setuid" and "setgid" files with owner privileges. This option must be used for mounting any file system not containing approved "setuid" and "setguid" files. Executing files from untrusted file systems increases the opportunity for unprivileged users to attain unauthorized administrative access.
Test Results

Status passed
Test Mount /dev/shm options is expected to include "nosuid"
Result
Result Details

Control V-81011
Title The Red Hat Enterprise Linux operating system must mount /dev/shm with the nosuid option.
Desc The "nosuid" mount option causes the system to not execute "setuid" and "setgid" files with owner privileges. This option must be used for mounting any file system not containing approved "setuid" and "setguid" files. Executing files from untrusted file systems increases the opportunity for unprivileged users to attain unauthorized administrative access.
Severity low
Impact 0.3
Nist Controls CM-7 (2), Rev_4
Check Text Verify that the "nosuid" option is configured for /dev/shm: # cat /etc/fstab | grep /dev/shm tmpfs /dev/shm tmpfs defaults,nodev,nosuid,noexec 0 0 If any results are returned and the "nosuid" option is not listed, this is a finding. Verify "/dev/shm" is mounted with the "nosuid" option: # mount | grep "/dev/shm" | grep nosuid If no results are returned, this is a finding.
Fix Text Configure the system so that /dev/shm is mounted with the "nosuid" option.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-81011" do title "The Red Hat Enterprise Linux operating system must mount /dev/shm with the nosuid option." desc "The \"nosuid\" mount option causes the system to not execute \"setuid\" and \"setgid\" files with owner privileges. This option must be used for mounting any file system not containing approved \"setuid\" and \"setguid\" files. Executing files from untrusted file systems increases the opportunity for unprivileged users to attain unauthorized administrative access." desc "rationale", "" desc "check", " Verify that the \"nosuid\" option is configured for /dev/shm: # cat /etc/fstab | grep /dev/shm tmpfs /dev/shm tmpfs defaults,nodev,nosuid,noexec 0 0 If any results are returned and the \"nosuid\" option is not listed, this is a finding. Verify \"/dev/shm\" is mounted with the \"nosuid\" option: # mount | grep \"/dev/shm\" | grep nosuid If no results are returned, this is a finding. " desc "fix", "Configure the system so that /dev/shm is mounted with the \"nosuid\" option." impact 0.3 tag severity: nil tag gtitle: "SRG-OS-000368-GPOS-00154" tag gid: "V-81011" tag rid: "SV-95723r2_rule" tag stig_id: "RHEL-07-021023" tag fix_id: "F-87845r2_fix" tag cci: ["CCI-001764"] tag nist: ["CM-7 (2)", "Rev_4"] describe mount('/dev/shm') do its('options') { should include 'nosuid' } end end
Accounts providing no operational purpose provide additional opportunities for system compromise. Unnecessary accounts include user accounts for individuals not requiring access to the system and application accounts for applications not installed on the system.
Test Results

Status passed
Test root is listed in allowed users.
Result
Status passed
Test bin is listed in allowed users.
Result
Status passed
Test daemon is listed in allowed users.
Result
Status passed
Test adm is listed in allowed users.
Result
Status passed
Test lp is listed in allowed users.
Result
Status passed
Test sync is listed in allowed users.
Result
Status passed
Test shutdown is listed in allowed users.
Result
Status passed
Test halt is listed in allowed users.
Result
Status passed
Test mail is listed in allowed users.
Result
Status passed
Test operator is listed in allowed users.
Result
Status passed
Test nobody is listed in allowed users.
Result
Status passed
Test systemd-network is listed in allowed users.
Result expected `systemd-network` to be in the list: `["root", "bin", "daemon", "adm", "lp", "sync", "shutdown", "halt", "mail", "operator", "nobody", "systemd-bus-proxy"]`
Status passed
Test dbus is listed in allowed users.
Result expected `dbus` to be in the list: `["root", "bin", "daemon", "adm", "lp", "sync", "shutdown", "halt", "mail", "operator", "nobody", "systemd-bus-proxy"]`
Status passed
Test polkitd is listed in allowed users.
Result expected `polkitd` to be in the list: `["root", "bin", "daemon", "adm", "lp", "sync", "shutdown", "halt", "mail", "operator", "nobody", "systemd-bus-proxy"]`
Status passed
Test sshd is listed in allowed users.
Result expected `sshd` to be in the list: `["root", "bin", "daemon", "adm", "lp", "sync", "shutdown", "halt", "mail", "operator", "nobody", "systemd-bus-proxy"]`
Status passed
Test postfix is listed in allowed users.
Result expected `postfix` to be in the list: `["root", "bin", "daemon", "adm", "lp", "sync", "shutdown", "halt", "mail", "operator", "nobody", "systemd-bus-proxy"]`
Status passed
Test chrony is listed in allowed users.
Result expected `chrony` to be in the list: `["root", "bin", "daemon", "adm", "lp", "sync", "shutdown", "halt", "mail", "operator", "nobody", "systemd-bus-proxy"]`
Status passed
Test ec2-user is listed in allowed users.
Result expected `ec2-user` to be in the list: `["root", "bin", "daemon", "adm", "lp", "sync", "shutdown", "halt", "mail", "operator", "nobody", "systemd-bus-proxy"]`
Status passed
Test tss is listed in allowed users.
Result expected `tss` to be in the list: `["root", "bin", "daemon", "adm", "lp", "sync", "shutdown", "halt", "mail", "operator", "nobody", "systemd-bus-proxy"]`
Status passed
Test sssd is listed in allowed users.
Result expected `sssd` to be in the list: `["root", "bin", "daemon", "adm", "lp", "sync", "shutdown", "halt", "mail", "operator", "nobody", "systemd-bus-proxy"]`
Result Details

Control V-72001
Title The Red Hat Enterprise Linux operating system must not have unnecessary accounts.
Desc Accounts providing no operational purpose provide additional opportunities for system compromise. Unnecessary accounts include user accounts for individuals not requiring access to the system and application accounts for applications not installed on the system.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify all accounts on the system are assigned to an active system, application, or user account. Obtain the list of authorized system accounts from the Information System Security Officer (ISSO). Check the system accounts on the system with the following command: # more /etc/passwd root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt games:x:12:100:games:/usr/games:/sbin/nologin gopher:x:13:30:gopher:/var/gopher:/sbin/nologin Accounts such as "games" and "gopher" are not authorized accounts as they do not support authorized system functions. If the accounts on the system do not match the provided documentation, or accounts that do not support an authorized system function are present, this is a finding.
Fix Text Configure the system so all accounts on the system are assigned to an active system, application, or user account. Remove accounts that do not support approved system activities or that allow for a normal user to perform administrative-level actions. Document all authorized accounts on the system.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72001" do title "The Red Hat Enterprise Linux operating system must not have unnecessary accounts." desc "Accounts providing no operational purpose provide additional opportunities for system compromise. Unnecessary accounts include user accounts for individuals not requiring access to the system and application accounts for applications not installed on the system." desc "rationale", "" desc "check", " Verify all accounts on the system are assigned to an active system, application, or user account. Obtain the list of authorized system accounts from the Information System Security Officer (ISSO). Check the system accounts on the system with the following command: # more /etc/passwd root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt games:x:12:100:games:/usr/games:/sbin/nologin gopher:x:13:30:gopher:/var/gopher:/sbin/nologin Accounts such as \"games\" and \"gopher\" are not authorized accounts as they do not support authorized system functions. If the accounts on the system do not match the provided documentation, or accounts that do not support an authorized system function are present, this is a finding. " desc "fix", " Configure the system so all accounts on the system are assigned to an active system, application, or user account. Remove accounts that do not support approved system activities or that allow for a normal user to perform administrative-level actions. Document all authorized accounts on the system. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72001" tag rid: "SV-86625r2_rule" tag stig_id: "RHEL-07-020270" tag fix_id: "F-78353r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] known_system_accounts = input('known_system_accounts') user_accounts = input('user_accounts') allowed_accounts = (known_system_accounts + user_accounts).uniq passwd.users.each do |user| describe user do it "is listed in allowed users." do expect(subject).to(be_in allowed_accounts) end end end end
A session lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not want to log out because of the temporary nature of the absence. The session lock is implemented at the point where session activity can be determined. The ability to enable/disable a session lock is given to the user by default. Disabling the user's ability to disengage the graphical user interface session lock provides the assurance that all sessions will lock after the specified period of time.
Test Results

Status skipped
Test The GNOME desktop is not installed
Result
Result Details

Control V-78997
Title The Red Hat Enterprise Linux operating system must prevent a user from overriding the screensaver idle-activation-enabled setting for the graphical user interface.
Desc A session lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not want to log out because of the temporary nature of the absence. The session lock is implemented at the point where session activity can be determined. The ability to enable/disable a session lock is given to the user by default. Disabling the user's ability to disengage the graphical user interface session lock provides the assurance that all sessions will lock after the specified period of time.
Severity none
Nist Controls AC-11 a, Rev_4
Check Text Verify the operating system prevents a user from overriding the screensaver idle-activation-enabled setting for the graphical user interface. Note: If the system does not have GNOME installed, this requirement is Not Applicable. The screen program must be installed to lock sessions on the console. Determine which profile the system database is using with the following command: # grep system-db /etc/dconf/profile/user system-db:local Check for the idle-activation-enabled setting with the following command: Note: The example below is using the database "local" for the system, so the path is "/etc/dconf/db/local.d". This path must be modified if a database other than "local" is being used. # grep -i idle-activation-enabled /etc/dconf/db/local.d/locks/* /org/gnome/desktop/screensaver/idle-activation-enabled If the command does not return a result, this is a finding.
Fix Text Configure the operating system to prevent a user from overriding a screensaver lock after a 15-minute period of inactivity for graphical user interfaces. Create a database to contain the system-wide screensaver settings (if it does not already exist) with the following command: Note: The example below is using the database "local" for the system, so if the system is using another database in "/etc/dconf/profile/user", the file should be created under the appropriate subdirectory. # touch /etc/dconf/db/local.d/locks/session Add the setting to lock the screensaver idle-activation-enabled setting: /org/gnome/desktop/screensaver/idle-activation-enabled

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-78997" do title "The Red Hat Enterprise Linux operating system must prevent a user from overriding the screensaver idle-activation-enabled setting for the graphical user interface." desc "A session lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not want to log out because of the temporary nature of the absence. The session lock is implemented at the point where session activity can be determined. The ability to enable/disable a session lock is given to the user by default. Disabling the user's ability to disengage the graphical user interface session lock provides the assurance that all sessions will lock after the specified period of time. " desc "rationale", "" desc "check", " Verify the operating system prevents a user from overriding the screensaver idle-activation-enabled setting for the graphical user interface. Note: If the system does not have GNOME installed, this requirement is Not Applicable. The screen program must be installed to lock sessions on the console. Determine which profile the system database is using with the following command: # grep system-db /etc/dconf/profile/user system-db:local Check for the idle-activation-enabled setting with the following command: Note: The example below is using the database \"local\" for the system, so the path is \"/etc/dconf/db/local.d\". This path must be modified if a database other than \"local\" is being used. # grep -i idle-activation-enabled /etc/dconf/db/local.d/locks/* /org/gnome/desktop/screensaver/idle-activation-enabled If the command does not return a result, this is a finding. " desc "fix", " Configure the operating system to prevent a user from overriding a screensaver lock after a 15-minute period of inactivity for graphical user interfaces. Create a database to contain the system-wide screensaver settings (if it does not already exist) with the following command: Note: The example below is using the database \"local\" for the system, so if the system is using another database in \"/etc/dconf/profile/user\", the file should be created under the appropriate subdirectory. # touch /etc/dconf/db/local.d/locks/session Add the setting to lock the screensaver idle-activation-enabled setting: /org/gnome/desktop/screensaver/idle-activation-enabled " tag severity: nil tag gtitle: "SRG-OS-000029-GPOS-00010" tag gid: "V-78997" tag rid: "SV-93703r2_rule" tag stig_id: "RHEL-07-010101" tag fix_id: "F-85747r1_fix" tag cci: ["CCI-000057"] tag nist: ["AC-11 a", "Rev_4"] if package('gnome-desktop3').installed? impact 0.5 else impact 0.0 end describe command("gsettings writable org.gnome.desktop.screensaver idle-activation-enabled") do its('stdout.strip') { should cmp 'false' } end if package('gnome-desktop3').installed? describe "The GNOME desktop is not installed" do skip "The GNOME desktop is not installed, this control is Not Applicable." end if !package('gnome-desktop3').installed? end
SSH daemon privilege separation causes the SSH process to drop root privileges when not needed, which would decrease the impact of software vulnerabilities in the unprivileged section.
Test Results

Status passed
Test SSHD Configuration UsePrivilegeSeparation is expected to cmp == "sandbox"
Result
Result Details

Control V-72265
Title The Red Hat Enterprise Linux operating system must be configured so that the SSH daemon uses privilege separation.
Desc SSH daemon privilege separation causes the SSH process to drop root privileges when not needed, which would decrease the impact of software vulnerabilities in the unprivileged section.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the SSH daemon performs privilege separation. Check that the SSH daemon performs privilege separation with the following command: # grep -i usepriv /etc/ssh/sshd_config UsePrivilegeSeparation sandbox If the "UsePrivilegeSeparation" keyword is set to "no", is missing, or the returned line is commented out, this is a finding.
Fix Text Uncomment the "UsePrivilegeSeparation" keyword in "/etc/ssh/sshd_config" (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor) and set the value to "sandbox" or "yes": UsePrivilegeSeparation sandbox The SSH service must be restarted for changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72265" do title "The Red Hat Enterprise Linux operating system must be configured so that the SSH daemon uses privilege separation." desc "SSH daemon privilege separation causes the SSH process to drop root privileges when not needed, which would decrease the impact of software vulnerabilities in the unprivileged section." desc "rationale", "" desc "check", " Verify the SSH daemon performs privilege separation. Check that the SSH daemon performs privilege separation with the following command: # grep -i usepriv /etc/ssh/sshd_config UsePrivilegeSeparation sandbox If the \"UsePrivilegeSeparation\" keyword is set to \"no\", is missing, or the returned line is commented out, this is a finding. " desc "fix", " Uncomment the \"UsePrivilegeSeparation\" keyword in \"/etc/ssh/sshd_config\" (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor) and set the value to \"sandbox\" or \"yes\": UsePrivilegeSeparation sandbox The SSH service must be restarted for changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72265" tag rid: "SV-86889r3_rule" tag stig_id: "RHEL-07-040460" tag fix_id: "F-78619r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe.one do describe sshd_config do its('UsePrivilegeSeparation') { should cmp 'sandbox' } end describe sshd_config do its('UsePrivilegeSeparation') { should cmp 'yes' } end end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with file == "/etc/group" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/etc/group" action is expected not to include "never"
Result
Status passed
Test ["w", "a"] is expected to include "w"
Result
Status passed
Test ["w", "a"] is expected to include "a"
Result
Result Details

Control V-73165
Title The Red Hat Enterprise Linux operating system must generate audit records for all account creations, modifications, disabling, and termination events that affect /etc/group.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AC-2 (4), AU-12 c, AC-2 (4), AC-2 (4), Rev_4
Check Text Verify the operating system must generate audit records for all account creations, modifications, disabling, and termination events that affect "/etc/group". Check the auditing rules in "/etc/audit/audit.rules" with the following command: # grep /etc/group /etc/audit/audit.rules -w /etc/group -p wa -k identity If the command does not return a line, or the line is commented out, this is a finding.
Fix Text Configure the operating system to generate audit records for all account creations, modifications, disabling, and termination events that affect "/etc/group". Add or update the following rule in "/etc/audit/rules.d/audit.rules": -w /etc/group -p wa -k identity The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-73165" do title "The Red Hat Enterprise Linux operating system must generate audit records for all account creations, modifications, disabling, and termination events that affect /etc/group." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system must generate audit records for all account creations, modifications, disabling, and termination events that affect \"/etc/group\". Check the auditing rules in \"/etc/audit/audit.rules\" with the following command: # grep /etc/group /etc/audit/audit.rules -w /etc/group -p wa -k identity If the command does not return a line, or the line is commented out, this is a finding. " desc "fix", " Configure the operating system to generate audit records for all account creations, modifications, disabling, and termination events that affect \"/etc/group\". Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -w /etc/group -p wa -k identity The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000004-GPOS-00004" tag gid: "V-73165" tag rid: "SV-87817r3_rule" tag stig_id: "RHEL-07-030871" tag fix_id: "F-79611r3_fix" tag cci: ["CCI-000018", "CCI-000172", "CCI-001403", "CCI-002130"] tag nist: ["AC-2 (4)", "AU-12 c", "AC-2 (4)", "AC-2 (4)", "Rev_4"] audit_file = '/etc/group' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'w' } it { should include 'a' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
Internet services that are not required for system or application processes must not be active to decrease the attack surface of the system. X Windows has a long history of security vulnerabilities and will not be used unless approved and documented.
Test Results

Status passed
Test System Package xorg-x11-server-common is expected not to be installed
Result
Result Details

Control V-72307
Title The Red Hat Enterprise Linux operating system must not have an X Windows display manager installed unless approved.
Desc Internet services that are not required for system or application processes must not be active to decrease the attack surface of the system. X Windows has a long history of security vulnerabilities and will not be used unless approved and documented.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify that if the system has X Windows System installed, it is authorized. Check for the X11 package with the following command: # rpm -qa | grep xorg | grep server Ask the System Administrator if use of the X Windows System is an operational requirement. If the use of X Windows on the system is not documented with the Information System Security Officer (ISSO), this is a finding.
Fix Text Document the requirement for an X Windows server with the ISSO or remove the related packages with the following commands: # rpm -e xorg-x11-server-common

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72307" do title "The Red Hat Enterprise Linux operating system must not have an X Windows display manager installed unless approved." desc "Internet services that are not required for system or application processes must not be active to decrease the attack surface of the system. X Windows has a long history of security vulnerabilities and will not be used unless approved and documented." desc "rationale", "" desc "check", " Verify that if the system has X Windows System installed, it is authorized. Check for the X11 package with the following command: # rpm -qa | grep xorg | grep server Ask the System Administrator if use of the X Windows System is an operational requirement. If the use of X Windows on the system is not documented with the Information System Security Officer (ISSO), this is a finding. " desc "fix", " Document the requirement for an X Windows server with the ISSO or remove the related packages with the following commands: # rpm -e xorg-x11-server-common " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72307" tag rid: "SV-86931r4_rule" tag stig_id: "RHEL-07-040730" tag fix_id: "F-78661r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] x11_enabled = input('x11_enabled') describe package('xorg-x11-server-common') do it { should_not be_installed } end if !x11_enabled describe package('xorg-x11-server-common') do it { should be_installed } end if x11_enabled end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with syscall == "ftruncate" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "ftruncate" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "ftruncate" arch == "b32" exit.uniq is expected to include "-EPERM"
Result
Status passed
Test Auditd Rules with syscall == "ftruncate" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "ftruncate" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "ftruncate" arch == "b32" exit.uniq is expected to include "-EACCES"
Result
Status passed
Test Auditd Rules with syscall == "ftruncate" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "ftruncate" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "ftruncate" arch == "b64" exit.uniq is expected to include "-EPERM"
Result
Status passed
Test Auditd Rules with syscall == "ftruncate" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "ftruncate" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "ftruncate" arch == "b64" exit.uniq is expected to include "-EACCES"
Result
Result Details

Control V-72133
Title The Red Hat Enterprise Linux operating system must audit all uses of the ftruncate syscall.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "ftruncate" syscall occur. Check the file system rules in "/etc/audit/audit.rules" with the following commands: # grep -iw ftruncate /etc/audit/audit.rules -a always,exit -F arch=b32 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b32 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access If both the "b32" and "b64" audit rules are not defined for the "ftruncate" syscall, this is a finding. If the output does not produce rules containing "-F exit=-EPERM", this is a finding. If the output does not produce rules containing "-F exit=-EACCES", this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "ftruncate" syscall occur. Add or update the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b32 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72133" do title "The Red Hat Enterprise Linux operating system must audit all uses of the ftruncate syscall." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"ftruncate\" syscall occur. Check the file system rules in \"/etc/audit/audit.rules\" with the following commands: # grep -iw ftruncate /etc/audit/audit.rules -a always,exit -F arch=b32 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b32 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access If both the \"b32\" and \"b64\" audit rules are not defined for the \"ftruncate\" syscall, this is a finding. If the output does not produce rules containing \"-F exit=-EPERM\", this is a finding. If the output does not produce rules containing \"-F exit=-EACCES\", this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"ftruncate\" syscall occur. Add or update the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b32 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S ftruncate -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S ftruncate -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000064-GPOS-00033" tag satisfies: ["SRG-OS-000064-GPOS-00033", "SRG-OS-000458-GPOS-00203", "SRG-OS-000461-GPOS-00205", "SRG-OS-000392-GPOS-00172"] tag gid: "V-72133" tag rid: "SV-86757r5_rule" tag stig_id: "RHEL-07-030550" tag fix_id: "F-78485r8_fix" tag cci: ["CCI-000172", "CCI-002884"] tag nist: ["AU-12 c", "MA-4 (1) (a)", "Rev_4"] describe auditd.syscall("ftruncate").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } its('exit.uniq') { should include '-EPERM' } end describe auditd.syscall("ftruncate").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } its('exit.uniq') { should include '-EACCES' } end if os.arch == 'x86_64' describe auditd.syscall("ftruncate").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } its('exit.uniq') { should include '-EPERM' } end describe auditd.syscall("ftruncate").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } its('exit.uniq') { should include '-EACCES' } end end end
Inactive identifiers pose a risk to systems and applications because attackers may exploit an inactive identifier and potentially obtain undetected access to the system. Owners of inactive accounts will not notice if unauthorized access to their user account has been obtained. Operating systems need to track periods of inactivity and disable application identifiers after zero days of inactivity.
Test Results

Status passed
Test Parse Config File /etc/default/useradd INACTIVE is expected to cmp >= 0
Result
Status passed
Test Parse Config File /etc/default/useradd INACTIVE is expected to cmp <= 0
Result
Result Details

Control V-71941
Title The Red Hat Enterprise Linux operating system must disable account identifiers (individuals, groups, roles, and devices) if the password expires.
Desc Inactive identifiers pose a risk to systems and applications because attackers may exploit an inactive identifier and potentially obtain undetected access to the system. Owners of inactive accounts will not notice if unauthorized access to their user account has been obtained. Operating systems need to track periods of inactivity and disable application identifiers after zero days of inactivity.
Severity medium
Impact 0.5
Nist Controls IA-4 e, Rev_4
Check Text If passwords are not being used for authentication, this is Not Applicable. Verify the operating system disables account identifiers (individuals, groups, roles, and devices) after the password expires with the following command: # grep -i inactive /etc/default/useradd INACTIVE=0 If the value is not set to "0", is commented out, or is not defined, this is a finding.
Fix Text Configure the operating system to disable account identifiers (individuals, groups, roles, and devices) after the password expires. Add the following line to "/etc/default/useradd" (or modify the line to have the required value): INACTIVE=0

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71941" do title "The Red Hat Enterprise Linux operating system must disable account identifiers (individuals, groups, roles, and devices) if the password expires." desc "Inactive identifiers pose a risk to systems and applications because attackers may exploit an inactive identifier and potentially obtain undetected access to the system. Owners of inactive accounts will not notice if unauthorized access to their user account has been obtained. Operating systems need to track periods of inactivity and disable application identifiers after zero days of inactivity. " desc "rationale", "" desc "check", " If passwords are not being used for authentication, this is Not Applicable. Verify the operating system disables account identifiers (individuals, groups, roles, and devices) after the password expires with the following command: # grep -i inactive /etc/default/useradd INACTIVE=0 If the value is not set to \"0\", is commented out, or is not defined, this is a finding. " desc "fix", " Configure the operating system to disable account identifiers (individuals, groups, roles, and devices) after the password expires. Add the following line to \"/etc/default/useradd\" (or modify the line to have the required value): INACTIVE=0 " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000118-GPOS-00060" tag gid: "V-71941" tag rid: "SV-86565r2_rule" tag stig_id: "RHEL-07-010310" tag fix_id: "F-78293r1_fix" tag cci: ["CCI-000795"] tag nist: ["IA-4 e", "Rev_4"] days_of_inactivity = input('days_of_inactivity') describe parse_config_file("/etc/default/useradd") do its('INACTIVE') { should cmp >= 0 } its('INACTIVE') { should cmp <= days_of_inactivity } end end
Virus scanning software can be used to protect a system from penetration from computer viruses and to limit their spread through intermediate systems. The virus scanning software should be configured to perform scans dynamically on accessed files. If this capability is not available, the system must be configured to scan, at a minimum, all altered files on the system on a daily basis. If the system processes inbound SMTP mail, the virus scanner must be configured to scan all received mail.
Test Results

Status passed
Test Service nails is expected to be running
Result expected that `Service nails` is running
Status passed
Test Service clamav-daemon.socket is expected to be running
Result expected that `Service clamav-daemon.socket` is running
Result Details

Control V-72213
Title The Red Hat Enterprise Linux operating system must use a virus scan program.
Desc Virus scanning software can be used to protect a system from penetration from computer viruses and to limit their spread through intermediate systems. The virus scanning software should be configured to perform scans dynamically on accessed files. If this capability is not available, the system must be configured to scan, at a minimum, all altered files on the system on a daily basis. If the system processes inbound SMTP mail, the virus scanner must be configured to scan all received mail.
Severity high
Impact 0.7
Nist Controls SI-3 a, Rev_4
Check Text Verify an anti-virus solution is installed on the system. The anti-virus solution may be bundled with an approved host-based security solution. If there is no anti-virus solution installed on the system, this is a finding.
Fix Text Install an antivirus solution on the system.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72213" do title "The Red Hat Enterprise Linux operating system must use a virus scan program." desc "Virus scanning software can be used to protect a system from penetration from computer viruses and to limit their spread through intermediate systems. The virus scanning software should be configured to perform scans dynamically on accessed files. If this capability is not available, the system must be configured to scan, at a minimum, all altered files on the system on a daily basis. If the system processes inbound SMTP mail, the virus scanner must be configured to scan all received mail. " desc "rationale", "" desc "check", " Verify an anti-virus solution is installed on the system. The anti-virus solution may be bundled with an approved host-based security solution. If there is no anti-virus solution installed on the system, this is a finding. " desc "fix", "Install an antivirus solution on the system." impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72213" tag rid: "SV-86837r3_rule" tag stig_id: "RHEL-07-032000" tag fix_id: "F-78567r2_fix" tag cci: ["CCI-001668"] tag nist: ["SI-3 a", "Rev_4"] custom_antivirus = input('custom_antivirus') if ! custom_antivirus describe.one do describe service('nails') do it { should be_running } end describe service('clamav-daemon.socket') do it { should be_running } end end else # Allow user to provide a description of their AV solution # for documentation. custom_antivirus_description = input('custom_antivirus_description') describe "Antivirus: #{custom_antivirus_description}" do subject { custom_antivirus_description } it { should_not cmp 'None' } end end end
Source-routed packets allow the source of the packet to suggest that routers forward the packet along a different path than configured on the router, which can be used to bypass network security measures. This requirement applies only to the forwarding of source-routed traffic, such as when IPv4 forwarding is enabled and the system is functioning as a router.
Test Results

Status passed
Test Kernel Parameter net.ipv4.conf.all.accept_source_route value is expected to eq 0
Result
Result Details

Control V-72283
Title The Red Hat Enterprise Linux operating system must not forward Internet Protocol version 4 (IPv4) source-routed packets.
Desc Source-routed packets allow the source of the packet to suggest that routers forward the packet along a different path than configured on the router, which can be used to bypass network security measures. This requirement applies only to the forwarding of source-routed traffic, such as when IPv4 forwarding is enabled and the system is functioning as a router.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the system does not accept IPv4 source-routed packets. # grep net.ipv4.conf.all.accept_source_route /etc/sysctl.conf /etc/sysctl.d/* net.ipv4.conf.all.accept_source_route = 0 If " net.ipv4.conf.all.accept_source_route " is not configured in the /etc/sysctl.conf file or in the /etc/sysctl.d/ directory, is commented out, or does not have a value of "0", this is a finding. Check that the operating system implements the accept source route variable with the following command: # /sbin/sysctl -a | grep net.ipv4.conf.all.accept_source_route net.ipv4.conf.all.accept_source_route = 0 If the returned line does not have a value of "0", this is a finding.
Fix Text Set the system to the required kernel parameter by adding the following line to "/etc/sysctl.conf" or a configuration file in the /etc/sysctl.d/ directory (or modify the line to have the required value): net.ipv4.conf.all.accept_source_route = 0 Issue the following command to make the changes take effect: # sysctl -system

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72283" do title "The Red Hat Enterprise Linux operating system must not forward Internet Protocol version 4 (IPv4) source-routed packets." desc "Source-routed packets allow the source of the packet to suggest that routers forward the packet along a different path than configured on the router, which can be used to bypass network security measures. This requirement applies only to the forwarding of source-routed traffic, such as when IPv4 forwarding is enabled and the system is functioning as a router." desc "rationale", "" desc "check", " Verify the system does not accept IPv4 source-routed packets. # grep net.ipv4.conf.all.accept_source_route /etc/sysctl.conf /etc/sysctl.d/* net.ipv4.conf.all.accept_source_route = 0 If \" net.ipv4.conf.all.accept_source_route \" is not configured in the /etc/sysctl.conf file or in the /etc/sysctl.d/ directory, is commented out, or does not have a value of \"0\", this is a finding. Check that the operating system implements the accept source route variable with the following command: # /sbin/sysctl -a | grep net.ipv4.conf.all.accept_source_route net.ipv4.conf.all.accept_source_route = 0 If the returned line does not have a value of \"0\", this is a finding. " desc "fix", " Set the system to the required kernel parameter by adding the following line to \"/etc/sysctl.conf\" or a configuration file in the /etc/sysctl.d/ directory (or modify the line to have the required value): net.ipv4.conf.all.accept_source_route = 0 Issue the following command to make the changes take effect: # sysctl -system " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72283" tag rid: "SV-86907r2_rule" tag stig_id: "RHEL-07-040610" tag fix_id: "F-78637r3_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe kernel_parameter('net.ipv4.conf.all.accept_source_route') do its('value') { should eq 0 } end end
If other users have access to modify user-specific SSH configuration files, they may be able to log on to the system as another user.
Test Results

Status passed
Test SSHD Configuration StrictModes is expected to cmp == "yes"
Result
Result Details

Control V-72263
Title The Red Hat Enterprise Linux operating system must be configured so that the SSH daemon performs strict mode checking of home directory configuration files.
Desc If other users have access to modify user-specific SSH configuration files, they may be able to log on to the system as another user.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the SSH daemon performs strict mode checking of home directory configuration files. The location of the "sshd_config" file may vary if a different daemon is in use. Inspect the "sshd_config" file with the following command: # grep -i strictmodes /etc/ssh/sshd_config StrictModes yes If "StrictModes" is set to "no", is missing, or the returned line is commented out, this is a finding.
Fix Text Uncomment the "StrictModes" keyword in "/etc/ssh/sshd_config" (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor) and set the value to "yes": StrictModes yes The SSH service must be restarted for changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72263" do title "The Red Hat Enterprise Linux operating system must be configured so that the SSH daemon performs strict mode checking of home directory configuration files." desc "If other users have access to modify user-specific SSH configuration files, they may be able to log on to the system as another user." desc "rationale", "" desc "check", " Verify the SSH daemon performs strict mode checking of home directory configuration files. The location of the \"sshd_config\" file may vary if a different daemon is in use. Inspect the \"sshd_config\" file with the following command: # grep -i strictmodes /etc/ssh/sshd_config StrictModes yes If \"StrictModes\" is set to \"no\", is missing, or the returned line is commented out, this is a finding. " desc "fix", " Uncomment the \"StrictModes\" keyword in \"/etc/ssh/sshd_config\" (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor) and set the value to \"yes\": StrictModes yes The SSH service must be restarted for changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72263" tag rid: "SV-86887r3_rule" tag stig_id: "RHEL-07-040450" tag fix_id: "F-78617r4_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe sshd_config do its('StrictModes') { should cmp 'yes' } end end
The use of separate file systems for different paths can protect the system from failures resulting from a file system becoming full or failing.
Test Results

Status passed
Test Service tmp.mount is expected to be enabled
Result expected that `Service tmp.mount` is enabled
Status passed
Test File System Table File (fstab) with mount_point == "/tmp" Should have a device name specified
Result expected nil to respond to `empty?`
Status passed
Test File System Table File (fstab) with mount_point == "/tmp" count is expected to cmp == 1
Result expected: 1 got: 0 (compared using `cmp` matcher)
Result Details

Control V-72065
Title The Red Hat Enterprise Linux operating system must use a separate file system for /tmp (or equivalent).
Desc The use of separate file systems for different paths can protect the system from failures resulting from a file system becoming full or failing.
Severity low
Impact 0.3
Nist Controls CM-6 b, Rev_4
Check Text Verify that a separate file system/partition has been created for "/tmp". Check that a file system/partition has been created for "/tmp" with the following command: # systemctl is-enabled tmp.mount enabled If the "tmp.mount" service is not enabled, check to see if "/tmp" is defined in the fstab with a device and mount point: # grep -i /tmp /etc/fstab UUID=a411dc99-f2a1-4c87-9e05-184977be8539 /tmp ext4 rw,relatime,discard,data=ordered,nosuid,noexec, 0 0 If "tmp.mount" service is not enabled and the "/tmp" directory is not defined in the fstab with a device and mount point, this is a finding.
Fix Text Start the "tmp.mount" service with the following command: # systemctl enable tmp.mount OR Edit the "/etc/fstab" file and ensure the "/tmp" directory is defined in the fstab with a device and mount point.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72065" do title "The Red Hat Enterprise Linux operating system must use a separate file system for /tmp (or equivalent)." desc "The use of separate file systems for different paths can protect the system from failures resulting from a file system becoming full or failing." desc "rationale", "" desc "check", " Verify that a separate file system/partition has been created for \"/tmp\". Check that a file system/partition has been created for \"/tmp\" with the following command: # systemctl is-enabled tmp.mount enabled If the \"tmp.mount\" service is not enabled, check to see if \"/tmp\" is defined in the fstab with a device and mount point: # grep -i /tmp /etc/fstab UUID=a411dc99-f2a1-4c87-9e05-184977be8539 /tmp ext4 rw,relatime,discard,data=ordered,nosuid,noexec, 0 0 If \"tmp.mount\" service is not enabled and the \"/tmp\" directory is not defined in the fstab with a device and mount point, this is a finding. " desc "fix", " Start the \"tmp.mount\" service with the following command: # systemctl enable tmp.mount OR Edit the \"/etc/fstab\" file and ensure the \"/tmp\" directory is defined in the fstab with a device and mount point. " impact 0.3 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72065" tag rid: "SV-86689r3_rule" tag stig_id: "RHEL-07-021340" tag fix_id: "F-78417r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe.one do describe systemd_service('tmp.mount') do it { should be_enabled } end describe etc_fstab.where { mount_point == '/tmp' } do its('count') { should cmp 1 } it 'Should have a device name specified' do expect(subject.device_name[0]).to_not(be_empty) end end end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with syscall == "fchmod" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "fchmod" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "fchmod" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "fchmod" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Result Details

Control V-72107
Title The Red Hat Enterprise Linux operating system must audit all uses of the fchmod syscall.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-12 c, Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "fchmod" syscall occur. Check the file system rules in "/etc/audit/audit.rules" with the following command: # grep -iw fchmod /etc/audit/audit.rules -a always,exit -F arch=b32 -S fchmod -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S fchmod -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the "b32" and "b64" audit rules are not defined for the "fchmod" syscall, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "fchmod" syscall occur. Add or update the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S fchmod -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S fchmod -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72107" do title "The Red Hat Enterprise Linux operating system must audit all uses of the fchmod syscall." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"fchmod\" syscall occur. Check the file system rules in \"/etc/audit/audit.rules\" with the following command: # grep -iw fchmod /etc/audit/audit.rules -a always,exit -F arch=b32 -S fchmod -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S fchmod -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the \"b32\" and \"b64\" audit rules are not defined for the \"fchmod\" syscall, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"fchmod\" syscall occur. Add or update the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S fchmod -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S fchmod -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000458-GPOS-00203" tag satisfies: ["SRG-OS-000458-GPOS-00203", "SRG-OS-000392-GPOS-00172", "SRG-OS-000064-GPOS-00033"] tag gid: "V-72107" tag rid: "SV-86731r5_rule" tag stig_id: "RHEL-07-030420" tag fix_id: "F-78459r9_fix" tag cci: ["CCI-000172"] tag nist: ["AU-12 c", "Rev_4"] describe auditd.syscall("fchmod").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end if os.arch == 'x86_64' describe auditd.syscall("fchmod").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end end end
The shorter the password, the lower the number of possible combinations that need to be tested before the password is compromised. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password length is one factor of several that helps to determine strength and how long it takes to crack a password. Use of more characters in a password helps to exponentially increase the time and/or resources required to compromise the password.
Test Results

Status passed
Test Parse Config File /etc/security/pwquality.conf minlen.to_i is expected to cmp >= 15
Result
Result Details

Control V-71935
Title The Red Hat Enterprise Linux operating system must be configured so that passwords are a minimum of 15 characters in length.
Desc The shorter the password, the lower the number of possible combinations that need to be tested before the password is compromised. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password length is one factor of several that helps to determine strength and how long it takes to crack a password. Use of more characters in a password helps to exponentially increase the time and/or resources required to compromise the password.
Severity medium
Impact 0.5
Nist Controls IA-5 (1) (a), Rev_4
Check Text Verify the operating system enforces a minimum 15-character password length. The "minlen" option sets the minimum number of characters in a new password. Check for the value of the "minlen" option in "/etc/security/pwquality.conf" with the following command: # grep minlen /etc/security/pwquality.conf minlen = 15 If the command does not return a "minlen" value of 15 or greater, this is a finding.
Fix Text Configure operating system to enforce a minimum 15-character password length. Add the following line to "/etc/security/pwquality.conf" (or modify the line to have the required value): minlen = 15

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71935" do title "The Red Hat Enterprise Linux operating system must be configured so that passwords are a minimum of 15 characters in length." desc "The shorter the password, the lower the number of possible combinations that need to be tested before the password is compromised. Password complexity, or strength, is a measure of the effectiveness of a password in resisting attempts at guessing and brute-force attacks. Password length is one factor of several that helps to determine strength and how long it takes to crack a password. Use of more characters in a password helps to exponentially increase the time and/or resources required to compromise the password. " desc "rationale", "" desc "check", " Verify the operating system enforces a minimum 15-character password length. The \"minlen\" option sets the minimum number of characters in a new password. Check for the value of the \"minlen\" option in \"/etc/security/pwquality.conf\" with the following command: # grep minlen /etc/security/pwquality.conf minlen = 15 If the command does not return a \"minlen\" value of 15 or greater, this is a finding. " desc "fix", " Configure operating system to enforce a minimum 15-character password length. Add the following line to \"/etc/security/pwquality.conf\" (or modify the line to have the required value): minlen = 15 " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000078-GPOS-00046" tag gid: "V-71935" tag rid: "SV-86559r2_rule" tag stig_id: "RHEL-07-010280" tag fix_id: "F-78287r1_fix" tag cci: ["CCI-000205"] tag nist: ["IA-5 (1) (a)", "Rev_4"] min_len = input('min_len') describe parse_config_file("/etc/security/pwquality.conf") do its('minlen.to_i') { should cmp >= min_len } end end
Without re-authentication, users may access resources or perform tasks for which they do not have authorization. When operating systems provide the capability to escalate a functional capability, it is critical the user re-authenticate.
Test Results

Status passed
Test Command: `grep -i nopasswd /etc/sudoers.d/90-cloud-init-users` stdout is expected not to match /^[^#]*NOPASSWD/
Result expected "ec2-user ALL=(ALL) NOPASSWD:ALL\n" not to match /^[^#]*NOPASSWD/ Diff: @@ -1,2 +1,2 @@ -/^[^#]*NOPASSWD/ +ec2-user ALL=(ALL) NOPASSWD:ALL
Status passed
Test Command: `grep -i nopasswd /etc/sudoers` stdout is expected not to match /^[^#]*NOPASSWD/
Result
Result Details

Control V-71947
Title The Red Hat Enterprise Linux operating system must be configured so that users must provide a password for privilege escalation.
Desc Without re-authentication, users may access resources or perform tasks for which they do not have authorization. When operating systems provide the capability to escalate a functional capability, it is critical the user re-authenticate.
Severity medium
Impact 0.5
Nist Controls IA-11, Rev_4
Check Text If passwords are not being used for authentication, this is Not Applicable. Verify the operating system requires users to supply a password for privilege escalation. Check the configuration of the "/etc/sudoers" and "/etc/sudoers.d/*" files with the following command: # grep -i nopasswd /etc/sudoers /etc/sudoers.d/* If any uncommented line is found with a "NOPASSWD" tag, this is a finding.
Fix Text Configure the operating system to require users to supply a password for privilege escalation. Check the configuration of the "/etc/sudoers" file with the following command: # visudo Remove any occurrences of "NOPASSWD" tags in the file. Check the configuration of the /etc/sudoers.d/* files with the following command: # grep -i nopasswd /etc/sudoers.d/* Remove any occurrences of "NOPASSWD" tags in the file.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71947" do title "The Red Hat Enterprise Linux operating system must be configured so that users must provide a password for privilege escalation." desc "Without re-authentication, users may access resources or perform tasks for which they do not have authorization. When operating systems provide the capability to escalate a functional capability, it is critical the user re-authenticate. " desc "rationale", "" desc "check", " If passwords are not being used for authentication, this is Not Applicable. Verify the operating system requires users to supply a password for privilege escalation. Check the configuration of the \"/etc/sudoers\" and \"/etc/sudoers.d/*\" files with the following command: # grep -i nopasswd /etc/sudoers /etc/sudoers.d/* If any uncommented line is found with a \"NOPASSWD\" tag, this is a finding. " desc "fix", " Configure the operating system to require users to supply a password for privilege escalation. Check the configuration of the \"/etc/sudoers\" file with the following command: # visudo Remove any occurrences of \"NOPASSWD\" tags in the file. Check the configuration of the /etc/sudoers.d/* files with the following command: # grep -i nopasswd /etc/sudoers.d/* Remove any occurrences of \"NOPASSWD\" tags in the file. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000373-GPOS-00156" tag satisfies: ["SRG-OS-000373-GPOS-00156", "SRG-OS-000373-GPOS-00157", "SRG-OS-000373-GPOS-00158"] tag gid: "V-71947" tag rid: "SV-86571r3_rule" tag stig_id: "RHEL-07-010340" tag fix_id: "F-78299r2_fix" tag cci: ["CCI-002038"] tag nist: ["IA-11", "Rev_4"] processed = [] to_process = ['/etc/sudoers', '/etc/sudoers.d'] while !to_process.empty? in_process = to_process.pop next if processed.include? in_process processed.push in_process if file(in_process).directory? to_process.concat( command("find #{in_process} -maxdepth 1 -mindepth 1"). stdout.strip.split("\n"). select { |f| file(f).file? } ) elsif file(in_process).file? to_process.concat( command("grep -E '#include\\s+' #{in_process} | sed 's/.*#include[[:space:]]*//g'"). stdout.strip.split("\n"). map { |f| f.start_with?('/') ? f : File.join(File.dirname(in_process), f) }. select { |f| file(f).exist? } ) to_process.concat( command("grep -E '#includedir\\s+' #{in_process} | sed 's/.*#includedir[[:space:]]*//g'"). stdout.strip.split("\n"). map { |f| f.start_with?('/') ? f : File.join(File.dirname(in_process), f) }. select { |f| file(f).exist? } ) end end sudoers = processed.select { |f| file(f).file? } sudoers.each do |sudoer| describe command("grep -i nopasswd #{sudoer}") do its('stdout') { should_not match %r{^[^#]*NOPASSWD} } end end end
A session lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not want to log out because of the temporary nature of the absence. The session lock is implemented at the point where session activity can be determined. Regardless of where the session lock is determined and implemented, once invoked, the session lock must remain in place until the user reauthenticates. No other activity aside from reauthentication must unlock the system.
Test Results

Status skipped
Test The system does not have GNOME installed
Result
Result Details

Control V-71891
Title The Red Hat Enterprise Linux operating system must enable a user session lock until that user re-establishes access using established identification and authentication procedures.
Desc A session lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not want to log out because of the temporary nature of the absence. The session lock is implemented at the point where session activity can be determined. Regardless of where the session lock is determined and implemented, once invoked, the session lock must remain in place until the user reauthenticates. No other activity aside from reauthentication must unlock the system.
Severity none
Nist Controls AC-11 b, Rev_4
Check Text Verify the operating system enables a user's session lock until that user re-establishes access using established identification and authentication procedures. The screen program must be installed to lock sessions on the console. Note: If the system does not have GNOME installed, this requirement is Not Applicable. Check to see if the screen lock is enabled with the following command: # grep -i lock-enabled /etc/dconf/db/local.d/* lock-enabled=true If the "lock-enabled" setting is missing or is not set to "true", this is a finding.
Fix Text Configure the operating system to enable a user's session lock until that user re-establishes access using established identification and authentication procedures. Create a database to contain the system-wide screensaver settings (if it does not already exist) with the following example: # touch /etc/dconf/db/local.d/00-screensaver Edit the "[org/gnome/desktop/screensaver]" section of the database file and add or update the following lines: # Set this to true to lock the screen when the screensaver activates lock-enabled=true Update the system databases: # dconf update Users must log out and back in again before the system-wide settings take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71891" do title "The Red Hat Enterprise Linux operating system must enable a user session lock until that user re-establishes access using established identification and authentication procedures." desc "A session lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not want to log out because of the temporary nature of the absence. The session lock is implemented at the point where session activity can be determined. Regardless of where the session lock is determined and implemented, once invoked, the session lock must remain in place until the user reauthenticates. No other activity aside from reauthentication must unlock the system. " desc "rationale", "" desc "check", " Verify the operating system enables a user's session lock until that user re-establishes access using established identification and authentication procedures. The screen program must be installed to lock sessions on the console. Note: If the system does not have GNOME installed, this requirement is Not Applicable. Check to see if the screen lock is enabled with the following command: # grep -i lock-enabled /etc/dconf/db/local.d/* lock-enabled=true If the \"lock-enabled\" setting is missing or is not set to \"true\", this is a finding. " desc "fix", " Configure the operating system to enable a user's session lock until that user re-establishes access using established identification and authentication procedures. Create a database to contain the system-wide screensaver settings (if it does not already exist) with the following example: # touch /etc/dconf/db/local.d/00-screensaver Edit the \"[org/gnome/desktop/screensaver]\" section of the database file and add or update the following lines: # Set this to true to lock the screen when the screensaver activates lock-enabled=true Update the system databases: # dconf update Users must log out and back in again before the system-wide settings take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000028-GPOS-00009" tag satisfies: ["SRG-OS-000028-GPOS-00009", "SRG-OS-000030-GPOS-00011"] tag gid: "V-71891" tag rid: "SV-86515r6_rule" tag stig_id: "RHEL-07-010060" tag fix_id: "F-78243r9_fix" tag cci: ["CCI-000056"] tag nist: ["AC-11 b", "Rev_4"] if package('gnome-desktop3').installed? describe command('gsettings get org.gnome.desktop.screensaver lock-enabled') do its('stdout.strip') { should cmp 'true' } end else impact 0.0 describe "The system does not have GNOME installed" do skip "The system does not have GNOME installed, this requirement is Not Applicable." end end end
Without cryptographic integrity protections, system command and files can be altered by unauthorized users without detection. Cryptographic mechanisms used for protecting the integrity of information include, for example, signed hash functions using asymmetric cryptography enabling distribution of the public key to verify the hash information while maintaining the confidentiality of the key used to generate the hash.
Test Results

Status skipped
Test This control consistently takes a long to run and has been disabled using the disable_slow_controls attribute.
Result
Result Details

Control V-71855
Title The Red Hat Enterprise Linux operating system must be configured so that the cryptographic hash of system files and commands matches vendor values.
Desc Without cryptographic integrity protections, system command and files can be altered by unauthorized users without detection. Cryptographic mechanisms used for protecting the integrity of information include, for example, signed hash functions using asymmetric cryptography enabling distribution of the public key to verify the hash information while maintaining the confidentiality of the key used to generate the hash.
Severity high
Impact 0.7
Nist Controls CM-5 (3), Rev_4
Check Text Verify the cryptographic hash of system files and commands match the vendor values. Check the cryptographic hash of system files and commands with the following command: Note: System configuration files (indicated by a "c" in the second column) are expected to change over time. Unusual modifications should be investigated through the system audit log. # rpm -Va --noconfig | grep '^..5' If there is any output from the command for system files or binaries, this is a finding.
Fix Text Run the following command to determine which package owns the file: # rpm -qf <filename> The package can be reinstalled from a yum repository using the command: # sudo yum reinstall <packagename> Alternatively, the package can be reinstalled from trusted media using the command: # sudo rpm -Uvh <packagename>

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71855" do title "The Red Hat Enterprise Linux operating system must be configured so that the cryptographic hash of system files and commands matches vendor values." desc "Without cryptographic integrity protections, system command and files can be altered by unauthorized users without detection. Cryptographic mechanisms used for protecting the integrity of information include, for example, signed hash functions using asymmetric cryptography enabling distribution of the public key to verify the hash information while maintaining the confidentiality of the key used to generate the hash. " desc "rationale", "" desc "check", " Verify the cryptographic hash of system files and commands match the vendor values. Check the cryptographic hash of system files and commands with the following command: Note: System configuration files (indicated by a \"c\" in the second column) are expected to change over time. Unusual modifications should be investigated through the system audit log. # rpm -Va --noconfig | grep '^..5' If there is any output from the command for system files or binaries, this is a finding. " desc "fix", " Run the following command to determine which package owns the file: # rpm -qf <filename> The package can be reinstalled from a yum repository using the command: # sudo yum reinstall <packagename> Alternatively, the package can be reinstalled from trusted media using the command: # sudo rpm -Uvh <packagename> " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-71855" tag rid: "SV-86479r4_rule" tag stig_id: "RHEL-07-010020" tag fix_id: "F-78207r1_fix" tag cci: ["CCI-001749"] tag nist: ["CM-5 (3)", "Rev_4"] if input('disable_slow_controls') describe "This control consistently takes a long to run and has been disabled using the disable_slow_controls attribute." do skip "This control consistently takes a long to run and has been disabled using the disable_slow_controls attribute. You must enable this control for a full accredidation for production." end else # grep excludes files that are marked with 'c' attribute (config files) describe command("rpm -Va | grep '^..5' | grep -E -v '[a-z]*c[a-z]*\\s+\\S+$' | awk 'NF>1{print $NF}'"). stdout.strip.split("\n") do it { should all(be_in rpm_verify_integrity_except) } end end end
Sending rsyslog output to another system ensures that the logs cannot be removed or modified in the event that the system is compromised or has a hardware failure.
Test Results

Status passed
Test Command: `grep @ /etc/rsyslog.conf | grep -v "^#"` stdout.strip is expected not to be empty
Result expected `"".empty?` to return false, got true
Result Details

Control V-72209
Title The Red Hat Enterprise Linux operating system must send rsyslog output to a log aggregation server.
Desc Sending rsyslog output to another system ensures that the logs cannot be removed or modified in the event that the system is compromised or has a hardware failure.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify "rsyslog" is configured to send all messages to a log aggregation server. Check the configuration of "rsyslog" with the following command: Note: If another logging package is used, substitute the utility configuration file for "/etc/rsyslog.conf". # grep @ /etc/rsyslog.conf /etc/rsyslog.d/*.conf *.* @@logagg.site.mil If there are no lines in the "/etc/rsyslog.conf" or "/etc/rsyslog.d/*.conf" files that contain the "@" or "@@" symbol(s), and the lines with the correct symbol(s) to send output to another system do not cover all "rsyslog" output, ask the System Administrator to indicate how the audit logs are off-loaded to a different system or media. If the lines are commented out or there is no evidence that the audit logs are being sent to another system, this is a finding.
Fix Text Modify the "/etc/rsyslog.conf" or an "/etc/rsyslog.d/*.conf" file to contain a configuration line to send all "rsyslog" output to a log aggregation system: *.* @@<log aggregation system name>

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72209" do title "The Red Hat Enterprise Linux operating system must send rsyslog output to a log aggregation server." desc "Sending rsyslog output to another system ensures that the logs cannot be removed or modified in the event that the system is compromised or has a hardware failure." desc "rationale", "" desc "check", " Verify \"rsyslog\" is configured to send all messages to a log aggregation server. Check the configuration of \"rsyslog\" with the following command: Note: If another logging package is used, substitute the utility configuration file for \"/etc/rsyslog.conf\". # grep @ /etc/rsyslog.conf /etc/rsyslog.d/*.conf *.* @@logagg.site.mil If there are no lines in the \"/etc/rsyslog.conf\" or \"/etc/rsyslog.d/*.conf\" files that contain the \"@\" or \"@@\" symbol(s), and the lines with the correct symbol(s) to send output to another system do not cover all \"rsyslog\" output, ask the System Administrator to indicate how the audit logs are off-loaded to a different system or media. If the lines are commented out or there is no evidence that the audit logs are being sent to another system, this is a finding. " desc "fix", " Modify the \"/etc/rsyslog.conf\" or an \"/etc/rsyslog.d/*.conf\" file to contain a configuration line to send all \"rsyslog\" output to a log aggregation system: *.* @@<log aggregation system name> " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72209" tag rid: "SV-86833r2_rule" tag stig_id: "RHEL-07-031000" tag fix_id: "F-78563r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] log_pkg_path = input('log_pkg_path') describe command("grep @ #{log_pkg_path} | grep -v \"^#\"") do its('stdout.strip') { should_not be_empty } end end
A session time-out lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not log out because of the temporary nature of the absence. Rather than relying on the user to manually lock their operating system session prior to vacating the vicinity, operating systems need to be able to identify when a user's session has idled and take action to initiate the session lock. The session lock is implemented at the point where session activity can be determined and/or controlled.
Test Results

Status skipped
Test The system does not have GNOME installed
Result
Result Details

Control V-71899
Title The Red Hat Enterprise Linux operating system must initiate a session lock for the screensaver after a period of inactivity for graphical user interfaces.
Desc A session time-out lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not log out because of the temporary nature of the absence. Rather than relying on the user to manually lock their operating system session prior to vacating the vicinity, operating systems need to be able to identify when a user's session has idled and take action to initiate the session lock. The session lock is implemented at the point where session activity can be determined and/or controlled.
Severity none
Nist Controls AC-11 a, Rev_4
Check Text Verify the operating system initiates a session lock after a 15-minute period of inactivity for graphical user interfaces. The screen program must be installed to lock sessions on the console. Note: If the system does not have a Graphical User Interface installed, this requirement is Not Applicable. Check for the session lock settings with the following commands: # grep -i idle-activation-enabled /etc/dconf/db/local.d/* idle-activation-enabled=true If "idle-activation-enabled" is not set to "true", this is a finding.
Fix Text Configure the operating system to initiate a session lock after a 15-minute period of inactivity for graphical user interfaces. Create a database to contain the system-wide screensaver settings (if it does not already exist) with the following command: # touch /etc/dconf/db/local.d/00-screensaver Add the setting to enable screensaver locking after 15 minutes of inactivity: [org/gnome/desktop/screensaver] idle-activation-enabled=true Update the system databases: # dconf update Users must log out and back in again before the system-wide settings take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71899" do title "The Red Hat Enterprise Linux operating system must initiate a session lock for the screensaver after a period of inactivity for graphical user interfaces." desc "A session time-out lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not log out because of the temporary nature of the absence. Rather than relying on the user to manually lock their operating system session prior to vacating the vicinity, operating systems need to be able to identify when a user's session has idled and take action to initiate the session lock. The session lock is implemented at the point where session activity can be determined and/or controlled. " desc "rationale", "" desc "check", " Verify the operating system initiates a session lock after a 15-minute period of inactivity for graphical user interfaces. The screen program must be installed to lock sessions on the console. Note: If the system does not have a Graphical User Interface installed, this requirement is Not Applicable. Check for the session lock settings with the following commands: # grep -i idle-activation-enabled /etc/dconf/db/local.d/* idle-activation-enabled=true If \"idle-activation-enabled\" is not set to \"true\", this is a finding. " desc "fix", " Configure the operating system to initiate a session lock after a 15-minute period of inactivity for graphical user interfaces. Create a database to contain the system-wide screensaver settings (if it does not already exist) with the following command: # touch /etc/dconf/db/local.d/00-screensaver Add the setting to enable screensaver locking after 15 minutes of inactivity: [org/gnome/desktop/screensaver] idle-activation-enabled=true Update the system databases: # dconf update Users must log out and back in again before the system-wide settings take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000029-GPOS-00010" tag gid: "V-71899" tag rid: "SV-86523r5_rule" tag stig_id: "RHEL-07-010100" tag fix_id: "F-78251r2_fix" tag cci: ["CCI-000057"] tag nist: ["AC-11 a", "Rev_4"] if package('gnome-desktop3').installed? describe command('gsettings get org.gnome.desktop.screensaver idle-activation-enabled') do its('stdout.strip') { should cmp 'true' } end else impact 0.0 describe "The system does not have GNOME installed" do skip "The system does not have GNOME installed, this requirement is Not Applicable." end end end
A session time-out lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not log out because of the temporary nature of the absence. Rather than relying on the user to manually lock their operating system session prior to vacating the vicinity, operating systems need to be able to identify when a user's session has idled and take action to initiate the session lock. The session lock is implemented at the point where session activity can be determined and/or controlled.
Test Results

Status skipped
Test The system does not have GNOME installed
Result
Result Details

Control V-71901
Title The Red Hat Enterprise Linux operating system must initiate a session lock for graphical user interfaces when the screensaver is activated.
Desc A session time-out lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not log out because of the temporary nature of the absence. Rather than relying on the user to manually lock their operating system session prior to vacating the vicinity, operating systems need to be able to identify when a user's session has idled and take action to initiate the session lock. The session lock is implemented at the point where session activity can be determined and/or controlled.
Severity none
Nist Controls AC-11 a, Rev_4
Check Text Verify the operating system initiates a session lock a for graphical user interfaces when the screensaver is activated. Note: If the system does not have GNOME installed, this requirement is Not Applicable. The screen program must be installed to lock sessions on the console. If GNOME is installed, check to see a session lock occurs when the screensaver is activated with the following command: # grep -i lock-delay /etc/dconf/db/local.d/* lock-delay=uint32 5 If the "lock-delay" setting is missing, or is not set to "5" or less, this is a finding.
Fix Text Configure the operating system to initiate a session lock for graphical user interfaces when a screensaver is activated. Create a database to contain the system-wide screensaver settings (if it does not already exist) with the following command: # touch /etc/dconf/db/local.d/00-screensaver Add the setting to enable session locking when a screensaver is activated: [org/gnome/desktop/screensaver] lock-delay=uint32 5 The "uint32" must be included along with the integer key values as shown. Update the system databases: # dconf update Users must log out and back in again before the system-wide settings take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71901" do title "The Red Hat Enterprise Linux operating system must initiate a session lock for graphical user interfaces when the screensaver is activated." desc "A session time-out lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not log out because of the temporary nature of the absence. Rather than relying on the user to manually lock their operating system session prior to vacating the vicinity, operating systems need to be able to identify when a user's session has idled and take action to initiate the session lock. The session lock is implemented at the point where session activity can be determined and/or controlled. " desc "rationale", "" desc "check", " Verify the operating system initiates a session lock a for graphical user interfaces when the screensaver is activated. Note: If the system does not have GNOME installed, this requirement is Not Applicable. The screen program must be installed to lock sessions on the console. If GNOME is installed, check to see a session lock occurs when the screensaver is activated with the following command: # grep -i lock-delay /etc/dconf/db/local.d/* lock-delay=uint32 5 If the \"lock-delay\" setting is missing, or is not set to \"5\" or less, this is a finding. " desc "fix", " Configure the operating system to initiate a session lock for graphical user interfaces when a screensaver is activated. Create a database to contain the system-wide screensaver settings (if it does not already exist) with the following command: # touch /etc/dconf/db/local.d/00-screensaver Add the setting to enable session locking when a screensaver is activated: [org/gnome/desktop/screensaver] lock-delay=uint32 5 The \"uint32\" must be included along with the integer key values as shown. Update the system databases: # dconf update Users must log out and back in again before the system-wide settings take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000029-GPOS-00010" tag gid: "V-71901" tag rid: "SV-86525r3_rule" tag stig_id: "RHEL-07-010110" tag fix_id: "F-78253r2_fix" tag cci: ["CCI-000057"] tag nist: ["AC-11 a", "Rev_4"] if package('gnome-desktop3').installed? describe command("gsettings get org.gnome.desktop.screensaver lock-delay | cut -d ' ' -f2") do its('stdout.strip') { should cmp <= lock_delay } end else impact 0.0 describe "The system does not have GNOME installed" do skip "The system does not have GNOME installed, this requirement is Not Applicable." end end end
ACLs can provide permissions beyond those permitted through the file mode and must be verified by file integrity tools.
Test Results

Status passed
Test System Package aide is expected to be installed
Result
Status passed
Test List of monitored files/directories without 'acl' rule is expected to be empty
Result
Result Details

Control V-72069
Title The Red Hat Enterprise Linux operating system must be configured so that the file integrity tool is configured to verify Access Control Lists (ACLs).
Desc ACLs can provide permissions beyond those permitted through the file mode and must be verified by file integrity tools.
Severity low
Impact 0.3
Nist Controls CM-6 b, Rev_4
Check Text Verify the file integrity tool is configured to verify ACLs. Check to see if Advanced Intrusion Detection Environment (AIDE) is installed on the system with the following command: # yum list installed aide If AIDE is not installed, ask the System Administrator how file integrity checks are performed on the system. If there is no application installed to perform file integrity checks, this is a finding. Note: AIDE is highly configurable at install time. These commands assume the "aide.conf" file is under the "/etc" directory. Use the following command to determine if the file is in another location: # find / -name aide.conf Check the "aide.conf" file to determine if the "acl" rule has been added to the rule list being applied to the files and directories selection lists. An example rule that includes the "acl" rule is below: All= p+i+n+u+g+s+m+S+sha512+acl+xattrs+selinux /bin All # apply the custom rule to the files in bin /sbin All # apply the same custom rule to the files in sbin If the "acl" rule is not being used on all uncommented selection lines in the "/etc/aide.conf" file, or ACLs are not being checked by another file integrity tool, this is a finding.
Fix Text Configure the file integrity tool to check file and directory ACLs. If AIDE is installed, ensure the "acl" rule is present on all uncommented file and directory selection lists.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72069" do title "The Red Hat Enterprise Linux operating system must be configured so that the file integrity tool is configured to verify Access Control Lists (ACLs)." desc "ACLs can provide permissions beyond those permitted through the file mode and must be verified by file integrity tools." desc "rationale", "" desc "check", " Verify the file integrity tool is configured to verify ACLs. Check to see if Advanced Intrusion Detection Environment (AIDE) is installed on the system with the following command: # yum list installed aide If AIDE is not installed, ask the System Administrator how file integrity checks are performed on the system. If there is no application installed to perform file integrity checks, this is a finding. Note: AIDE is highly configurable at install time. These commands assume the \"aide.conf\" file is under the \"/etc\" directory. Use the following command to determine if the file is in another location: # find / -name aide.conf Check the \"aide.conf\" file to determine if the \"acl\" rule has been added to the rule list being applied to the files and directories selection lists. An example rule that includes the \"acl\" rule is below: All= p+i+n+u+g+s+m+S+sha512+acl+xattrs+selinux /bin All # apply the custom rule to the files in bin /sbin All # apply the same custom rule to the files in sbin If the \"acl\" rule is not being used on all uncommented selection lines in the \"/etc/aide.conf\" file, or ACLs are not being checked by another file integrity tool, this is a finding. " desc "fix", " Configure the file integrity tool to check file and directory ACLs. If AIDE is installed, ensure the \"acl\" rule is present on all uncommented file and directory selection lists. " impact 0.3 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72069" tag rid: "SV-86693r3_rule" tag stig_id: "RHEL-07-021600" tag fix_id: "F-78421r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe package("aide") do it { should be_installed } end findings = [] aide_conf.where { !selection_line.start_with? '!' }.entries.each do |selection| unless selection.rules.include? 'acl' findings.append(selection.selection_line) end end describe "List of monitored files/directories without 'acl' rule" do subject { findings } it { should be_empty } end end
The use of separate file systems for different paths can protect the system from failures resulting from a file system becoming full or failing.
Test Results

Status passed
Test Mount /var/log/audit is expected to be mounted
Result Mount /var/log/audit is not mounted
Result Details

Control V-72063
Title The Red Hat Enterprise Linux operating system must use a separate file system for the system audit data path.
Desc The use of separate file systems for different paths can protect the system from failures resulting from a file system becoming full or failing.
Severity low
Impact 0.3
Nist Controls CM-6 b, Rev_4
Check Text Determine if the operating system is configured to have the "/var/log/audit" path is on a separate file system. # grep /var/log/audit /etc/fstab If no result is returned, or the operating system is not configured to have "/var/log/audit" on a separate file system, this is a finding. Verify that "/var/log/audit" is mounted on a separate file system: # mount | grep "/var/log/audit" If no result is returned, or "/var/log/audit" is not on a separate file system, this is a finding.
Fix Text Migrate the system audit data path onto a separate file system.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72063" do title "The Red Hat Enterprise Linux operating system must use a separate file system for the system audit data path." desc "The use of separate file systems for different paths can protect the system from failures resulting from a file system becoming full or failing." desc "rationale", "" desc "check", " Determine if the operating system is configured to have the \"/var/log/audit\" path is on a separate file system. # grep /var/log/audit /etc/fstab If no result is returned, or the operating system is not configured to have \"/var/log/audit\" on a separate file system, this is a finding. Verify that \"/var/log/audit\" is mounted on a separate file system: # mount | grep \"/var/log/audit\" If no result is returned, or \"/var/log/audit\" is not on a separate file system, this is a finding. " desc "fix", "Migrate the system audit data path onto a separate file system." impact 0.3 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72063" tag rid: "SV-86687r6_rule" tag stig_id: "RHEL-07-021330" tag fix_id: "F-78415r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe mount('/var/log/audit') do it {should be_mounted} end end
Local initialization files for interactive users are used to configure the user's shell environment upon logon. Malicious modification of these files could compromise accounts upon logon.
Test Results

Status passed
Test #<Set: {}> length is expected to == 0
Result
Result Details

Control V-72031
Title The Red Hat Enterprise Linux operating system must be configured so that all local initialization files for local interactive users are be group-owned by the users primary group or root.
Desc Local initialization files for interactive users are used to configure the user's shell environment upon logon. Malicious modification of these files could compromise accounts upon logon.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the local initialization files of all local interactive users are group-owned by that user's primary Group Identifier (GID). Check the home directory assignment for all non-privileged users on the system with the following command: Note: The example will be for the smithj user, who has a home directory of "/home/smithj" and a primary group of "users". # cut -d: -f 1,4,6 /etc/passwd | egrep ":[1-4][0-9]{3}" smithj:1000:/home/smithj # grep 1000 /etc/group users:x:1000:smithj,jonesj,jacksons Note: This may miss interactive users that have been assigned a privileged User Identifier (UID). Evidence of interactive use may be obtained from a number of log files containing system logon information. Check the group owner of all local interactive user's initialization files with the following command: # ls -al /home/smithj/.[^.]* | more -rwxr-xr-x 1 smithj users 896 Mar 10 2011 .profile -rwxr-xr-x 1 smithj users 497 Jan 6 2007 .login -rwxr-xr-x 1 smithj users 886 Jan 6 2007 .something If all local interactive user's initialization files are not group-owned by that user's primary GID, this is a finding.
Fix Text Change the group owner of a local interactive user's files to the group found in "/etc/passwd" for the user. To change the group owner of a local interactive user's home directory, use the following command: Note: The example will be for the user smithj, who has a home directory of "/home/smithj", and has a primary group of users. # chgrp users /home/smithj/.[^.]*

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72031" do title "The Red Hat Enterprise Linux operating system must be configured so that all local initialization files for local interactive users are be group-owned by the users primary group or root." desc "Local initialization files for interactive users are used to configure the user's shell environment upon logon. Malicious modification of these files could compromise accounts upon logon." desc "rationale", "" desc "check", " Verify the local initialization files of all local interactive users are group-owned by that user's primary Group Identifier (GID). Check the home directory assignment for all non-privileged users on the system with the following command: Note: The example will be for the smithj user, who has a home directory of \"/home/smithj\" and a primary group of \"users\". # cut -d: -f 1,4,6 /etc/passwd | egrep \":[1-4][0-9]{3}\" smithj:1000:/home/smithj # grep 1000 /etc/group users:x:1000:smithj,jonesj,jacksons Note: This may miss interactive users that have been assigned a privileged User Identifier (UID). Evidence of interactive use may be obtained from a number of log files containing system logon information. Check the group owner of all local interactive user's initialization files with the following command: # ls -al /home/smithj/.[^.]* | more -rwxr-xr-x 1 smithj users 896 Mar 10 2011 .profile -rwxr-xr-x 1 smithj users 497 Jan 6 2007 .login -rwxr-xr-x 1 smithj users 886 Jan 6 2007 .something If all local interactive user's initialization files are not group-owned by that user's primary GID, this is a finding. " desc "fix", " Change the group owner of a local interactive user's files to the group found in \"/etc/passwd\" for the user. To change the group owner of a local interactive user's home directory, use the following command: Note: The example will be for the user smithj, who has a home directory of \"/home/smithj\", and has a primary group of users. # chgrp users /home/smithj/.[^.]* " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72031" tag rid: "SV-86655r4_rule" tag stig_id: "RHEL-07-020700" tag fix_id: "F-78383r4_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] exempt_home_users = input('exempt_home_users') non_interactive_shells = input('non_interactive_shells') ignore_shells = non_interactive_shells.join('|') findings = Set[] users.where{ !shell.match(ignore_shells) && (uid >= 1000 || uid == 0)}.entries.each do |user_info| findings = findings + command("find #{user_info.home} -name '.*' -not -gid #{user_info.gid} -not -group root").stdout.split("\n") end describe findings do its('length') { should == 0 } end end
Passwords need to be protected at all times, and encryption is the standard method for protecting passwords. If passwords are not encrypted, they can be plainly read (i.e., clear text) and easily compromised. Passwords encrypted with a weak algorithm are no more protected than if they are kept in plain text.
Test Results

Status passed
Test Command: `cat /etc/libuser.conf | grep -i sha512` stdout.strip is expected to match /^crypt_style = sha512$/
Result
Result Details

Control V-71923
Title The Red Hat Enterprise Linux operating system must be configured so that user and group account administration utilities are configured to store only encrypted representations of passwords.
Desc Passwords need to be protected at all times, and encryption is the standard method for protecting passwords. If passwords are not encrypted, they can be plainly read (i.e., clear text) and easily compromised. Passwords encrypted with a weak algorithm are no more protected than if they are kept in plain text.
Severity medium
Impact 0.5
Nist Controls IA-5 (1) (c), Rev_4
Check Text Verify the user and group account administration utilities are configured to store only encrypted representations of passwords. The strength of encryption that must be used to hash passwords for all accounts is "SHA512". Check that the system is configured to create "SHA512" hashed passwords with the following command: # grep -i sha512 /etc/libuser.conf crypt_style = sha512 If the "crypt_style" variable is not set to "sha512", is not in the defaults section, is commented out, or does not exist, this is a finding.
Fix Text Configure the operating system to store only SHA512 encrypted representations of passwords. Add or update the following line in "/etc/libuser.conf" in the [defaults] section: crypt_style = sha512

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71923" do title "The Red Hat Enterprise Linux operating system must be configured so that user and group account administration utilities are configured to store only encrypted representations of passwords." desc "Passwords need to be protected at all times, and encryption is the standard method for protecting passwords. If passwords are not encrypted, they can be plainly read (i.e., clear text) and easily compromised. Passwords encrypted with a weak algorithm are no more protected than if they are kept in plain text." desc "rationale", "" desc "check", " Verify the user and group account administration utilities are configured to store only encrypted representations of passwords. The strength of encryption that must be used to hash passwords for all accounts is \"SHA512\". Check that the system is configured to create \"SHA512\" hashed passwords with the following command: # grep -i sha512 /etc/libuser.conf crypt_style = sha512 If the \"crypt_style\" variable is not set to \"sha512\", is not in the defaults section, is commented out, or does not exist, this is a finding. " desc "fix", " Configure the operating system to store only SHA512 encrypted representations of passwords. Add or update the following line in \"/etc/libuser.conf\" in the [defaults] section: crypt_style = sha512 " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000073-GPOS-00041" tag gid: "V-71923" tag rid: "SV-86547r3_rule" tag stig_id: "RHEL-07-010220" tag fix_id: "F-78275r1_fix" tag cci: ["CCI-000196"] tag nist: ["IA-5 (1) (c)", "Rev_4"] describe command("cat /etc/libuser.conf | grep -i sha512") do its('stdout.strip') { should match %r(^crypt_style = sha512$) } end end
If the system does not require valid root authentication before it boots into single-user or maintenance mode, anyone who invokes single-user or maintenance mode is granted privileged access to all files on the system. GRUB 2 is the default boot loader for RHEL 7 and is designed to require a password to boot into single-user mode or make modifications to the boot menu.
Test Results

Status skipped
Test System running BIOS
Result
Result Details

Control V-81007
Title Red Hat Enterprise Linux operating systems version 7.2 or newer using Unified Extensible Firmware Interface (UEFI) must require authentication upon booting into single-user and maintenance modes.
Desc If the system does not require valid root authentication before it boots into single-user or maintenance mode, anyone who invokes single-user or maintenance mode is granted privileged access to all files on the system. GRUB 2 is the default boot loader for RHEL 7 and is designed to require a password to boot into single-user mode or make modifications to the boot menu.
Severity none
Nist Controls AC-3, Rev_4
Check Text For systems that use BIOS, this is Not Applicable. For systems that are running a version of RHEL prior to 7.2, this is Not Applicable. Check to see if an encrypted root password is set. On systems that use UEFI, use the following command: # grep -iw grub2_password /boot/efi/EFI/redhat/user.cfg GRUB2_PASSWORD=grub.pbkdf2.sha512.[password_hash] If the root password does not begin with "grub.pbkdf2.sha512", this is a finding. Verify that the "root" account is set as the "superusers": # grep -iw "superusers" /boot/efi/EFI/redhat/grub.cfg set superusers="root" export superusers If "superusers" is not set to "root", this is a finding.
Fix Text Configure the system to encrypt the boot password for root. Generate an encrypted grub2 password for root with the following command: Note: The hash generated is an example. # grub2-setpassword Enter password: Confirm password: Edit the /boot/efi/EFI/redhat/grub.cfg file and add or modify the following lines in the "### BEGIN /etc/grub.d/01_users ###" section: set superusers="root" export superusers

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-81007" do title "Red Hat Enterprise Linux operating systems version 7.2 or newer using Unified Extensible Firmware Interface (UEFI) must require authentication upon booting into single-user and maintenance modes." desc "If the system does not require valid root authentication before it boots into single-user or maintenance mode, anyone who invokes single-user or maintenance mode is granted privileged access to all files on the system. GRUB 2 is the default boot loader for RHEL 7 and is designed to require a password to boot into single-user mode or make modifications to the boot menu." desc "rationale", "" desc "check", " For systems that use BIOS, this is Not Applicable. For systems that are running a version of RHEL prior to 7.2, this is Not Applicable. Check to see if an encrypted root password is set. On systems that use UEFI, use the following command: # grep -iw grub2_password /boot/efi/EFI/redhat/user.cfg GRUB2_PASSWORD=grub.pbkdf2.sha512.[password_hash] If the root password does not begin with \"grub.pbkdf2.sha512\", this is a finding. Verify that the \"root\" account is set as the \"superusers\": # grep -iw \"superusers\" /boot/efi/EFI/redhat/grub.cfg set superusers=\"root\" export superusers If \"superusers\" is not set to \"root\", this is a finding. " desc "fix", " Configure the system to encrypt the boot password for root. Generate an encrypted grub2 password for root with the following command: Note: The hash generated is an example. # grub2-setpassword Enter password: Confirm password: Edit the /boot/efi/EFI/redhat/grub.cfg file and add or modify the following lines in the \"### BEGIN /etc/grub.d/01_users ###\" section: set superusers=\"root\" export superusers " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000080-GPOS-00048" tag gid: "V-81007" tag rid: "SV-95719r1_rule" tag stig_id: "RHEL-07-010491" tag fix_id: "F-87841r2_fix" tag cci: ["CCI-000213"] tag nist: ["AC-3", "Rev_4"] unless file('/sys/firmware/efi').exist? impact 0.0 describe "System running BIOS" do skip "The System is running BIOS, this control is Not Applicable." end else unless os[:release] >= "7.2" impact 0.0 describe "System running version of RHEL prior to 7.2" do skip "The System is running an outdated version of RHEL, this control is Not Applicable." end else impact 0.7 input('grub_uefi_user_boot_files').each do |grub_user_file| describe parse_config_file(grub_user_file) do its('GRUB2_PASSWORD') { should include "grub.pbkdf2.sha512"} end end describe parse_config_file(input('grub_uefi_main_cfg')) do its('set superusers') { should cmp '"root"' } end end end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with syscall == "fremovexattr" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "fremovexattr" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "fremovexattr" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "fremovexattr" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Result Details

Control V-72119
Title The Red Hat Enterprise Linux operating system must audit all uses of the fremovexattr syscall.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-12 c, Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "fremovexattr" syscall occur. Check the file system rules in "/etc/audit/audit.rules" with the following commands: # grep -iw fremovexattr /etc/audit/audit.rules -a always,exit -F arch=b32 -S fremovexattr -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S fremovexattr -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the "b32" and "b64" audit rules are not defined for the "fremovexattr" syscall, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "fremovexattr" syscall occur. Add or update the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S fremovexattr -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S fremovexattr -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72119" do title "The Red Hat Enterprise Linux operating system must audit all uses of the fremovexattr syscall." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"fremovexattr\" syscall occur. Check the file system rules in \"/etc/audit/audit.rules\" with the following commands: # grep -iw fremovexattr /etc/audit/audit.rules -a always,exit -F arch=b32 -S fremovexattr -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S fremovexattr -F auid>=1000 -F auid!=4294967295 -k perm_mod If both the \"b32\" and \"b64\" audit rules are not defined for the \"fremovexattr\" syscall, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"fremovexattr\" syscall occur. Add or update the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S fremovexattr -F auid>=1000 -F auid!=4294967295 -k perm_mod -a always,exit -F arch=b64 -S fremovexattr -F auid>=1000 -F auid!=4294967295 -k perm_mod The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000458-GPOS-00203" tag satisfies: ["SRG-OS-000458-GPOS-00203", "SRG-OS-000392-GPOS-00172", "SRG-OS-000064-GPOS-00033"] tag gid: "V-72119" tag rid: "SV-86743r5_rule" tag stig_id: "RHEL-07-030480" tag fix_id: "F-78471r6_fix" tag cci: ["CCI-000172"] tag nist: ["AU-12 c", "Rev_4"] describe auditd.syscall("fremovexattr").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end if os.arch == 'x86_64' describe auditd.syscall("fremovexattr").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with file == "/etc/passwd" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/etc/passwd" action is expected not to include "never"
Result
Status passed
Test ["w", "a"] is expected to include "w"
Result
Status passed
Test ["w", "a"] is expected to include "a"
Result
Result Details

Control V-72197
Title The Red Hat Enterprise Linux operating system must generate audit records for all account creations, modifications, disabling, and termination events that affect /etc/passwd.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AC-2 (4), AU-12 c, AC-2 (4), AC-2 (4), Rev_4
Check Text Verify the operating system must generate audit records for all account creations, modifications, disabling, and termination events that affect "/etc/passwd". Check the auditing rules in "/etc/audit/audit.rules" with the following command: # grep /etc/passwd /etc/audit/audit.rules -w /etc/passwd -p wa -k identity If the command does not return a line, or the line is commented out, this is a finding.
Fix Text Configure the operating system to generate audit records for all account creations, modifications, disabling, and termination events that affect "/etc/passwd". Add or update the following rule "/etc/audit/rules.d/audit.rules": -w /etc/passwd -p wa -k identity The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72197" do title "The Red Hat Enterprise Linux operating system must generate audit records for all account creations, modifications, disabling, and termination events that affect /etc/passwd." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system must generate audit records for all account creations, modifications, disabling, and termination events that affect \"/etc/passwd\". Check the auditing rules in \"/etc/audit/audit.rules\" with the following command: # grep /etc/passwd /etc/audit/audit.rules -w /etc/passwd -p wa -k identity If the command does not return a line, or the line is commented out, this is a finding. " desc "fix", " Configure the operating system to generate audit records for all account creations, modifications, disabling, and termination events that affect \"/etc/passwd\". Add or update the following rule \"/etc/audit/rules.d/audit.rules\": -w /etc/passwd -p wa -k identity The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000004-GPOS-00004" tag satisfies: ["SRG-OS-000004-GPOS-00004", "SRG-OS-000239-GPOS-00089", "SRG-OS-000240-GPOS-00090", "SRG-OS-000241-GPOS-00091", "SRG-OS-000303-GPOS-00120", "SRG-OS-000476-GPOS-00221"] tag gid: "V-72197" tag rid: "SV-86821r5_rule" tag stig_id: "RHEL-07-030870" tag fix_id: "F-78551r4_fix" tag cci: ["CCI-000018", "CCI-000172", "CCI-001403", "CCI-002130"] tag nist: ["AC-2 (4)", "AU-12 c", "AC-2 (4)", "AC-2 (4)", "Rev_4"] audit_file = '/etc/passwd' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'w' } it { should include 'a' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with syscall == "open" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "open" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "open" arch == "b32" exit.uniq is expected to include "-EPERM"
Result
Status passed
Test Auditd Rules with syscall == "open" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "open" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "open" arch == "b32" exit.uniq is expected to include "-EACCES"
Result
Status passed
Test Auditd Rules with syscall == "open" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "open" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "open" arch == "b64" exit.uniq is expected to include "-EPERM"
Result
Status passed
Test Auditd Rules with syscall == "open" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "open" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "open" arch == "b64" exit.uniq is expected to include "-EACCES"
Result
Result Details

Control V-72125
Title The Red Hat Enterprise Linux operating system must audit all uses of the open syscall.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "open" syscall occur. Check the file system rules in "/etc/audit/audit.rules" with the following commands: # grep -iw open /etc/audit/audit.rules -a always,exit -F arch=b32 -S open -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b32 -S open -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S open -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S open -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access If both the "b32" and "b64" audit rules are not defined for the "open" syscall, this is a finding. If the output does not produce rules containing "-F exit=-EPERM", this is a finding. If the output does not produce rules containing "-F exit=-EACCES", this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "open" syscall occur. Add or update the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S open -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b32 -S open -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S open -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S open -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72125" do title "The Red Hat Enterprise Linux operating system must audit all uses of the open syscall." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"open\" syscall occur. Check the file system rules in \"/etc/audit/audit.rules\" with the following commands: # grep -iw open /etc/audit/audit.rules -a always,exit -F arch=b32 -S open -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b32 -S open -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S open -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S open -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access If both the \"b32\" and \"b64\" audit rules are not defined for the \"open\" syscall, this is a finding. If the output does not produce rules containing \"-F exit=-EPERM\", this is a finding. If the output does not produce rules containing \"-F exit=-EACCES\", this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"open\" syscall occur. Add or update the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S open -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b32 -S open -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S open -F exit=-EPERM -F auid>=1000 -F auid!=4294967295 -k access -a always,exit -F arch=b64 -S open -F exit=-EACCES -F auid>=1000 -F auid!=4294967295 -k access The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000064-GPOS-00033" tag satisfies: ["SRG-OS-000064-GPOS-00033", "SRG-OS-000458-GPOS-00203", "SRG-OS-000461-GPOS-00205", "SRG-OS-000392-GPOS-00172"] tag gid: "V-72125" tag rid: "SV-86749r5_rule" tag stig_id: "RHEL-07-030510" tag fix_id: "F-78477r7_fix" tag cci: ["CCI-000172", "CCI-002884"] tag nist: ["AU-12 c", "MA-4 (1) (a)", "Rev_4"] describe auditd.syscall("open").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } its('exit.uniq') { should include '-EPERM' } end describe auditd.syscall("open").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } its('exit.uniq') { should include '-EACCES' } end if os.arch == 'x86_64' describe auditd.syscall("open").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } its('exit.uniq') { should include '-EPERM' } end describe auditd.syscall("open").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } its('exit.uniq') { should include '-EACCES' } end end end
Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged access commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Test Results

Status passed
Test Auditd Rules with file == "/usr/bin/sudo" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/usr/bin/sudo" action is expected not to include "never"
Result
Status passed
Test ["x"] is expected to include "x"
Result
Status passed
Test ["x"] is expected to include "x"
Result
Result Details

Control V-72161
Title The Red Hat Enterprise Linux operating system must audit all uses of the sudo command.
Desc Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged access commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Severity medium
Impact 0.5
Nist Controls AU-3, AU-3 (1), AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "sudo" command occur. Check that the following system call is being audited by performing the following command to check the file system rules in "/etc/audit/audit.rules": # grep -iw /usr/bin/sudo /etc/audit/audit.rules -a always,exit -F path=/usr/bin/sudo -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change If the command does not return any output, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "sudo" command occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules": -a always,exit -F path=/usr/bin/sudo -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72161" do title "The Red Hat Enterprise Linux operating system must audit all uses of the sudo command." desc "Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged access commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise. " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"sudo\" command occur. Check that the following system call is being audited by performing the following command to check the file system rules in \"/etc/audit/audit.rules\": # grep -iw /usr/bin/sudo /etc/audit/audit.rules -a always,exit -F path=/usr/bin/sudo -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change If the command does not return any output, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"sudo\" command occur. Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F path=/usr/bin/sudo -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000037-GPOS-00015" tag satisfies: ["SRG-OS-000037-GPOS-00015", "SRG-OS-000042-GPOS-00020", "SRG-OS-000392-GPOS-00172", "SRG-OS-000462-GPOS-00206", "SRG-OS-000471-GPOS-00215"] tag gid: "V-72161" tag rid: "SV-86785r4_rule" tag stig_id: "RHEL-07-030690" tag fix_id: "F-78513r5_fix" tag cci: ["CCI-000130", "CCI-000135", "CCI-000172", "CCI-002884"] tag nist: ["AU-3", "AU-3 (1)", "AU-12 c", "MA-4 (1) (a)", "Rev_4"] audit_file = '/usr/bin/sudo' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'x' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
If a local interactive user has a home directory defined that does not exist, the user may be given access to the / directory as the current working directory upon logon. This could create a Denial of Service because the user would not be able to access their logon configuration files, and it may give them visibility to system files they normally would not be able to access.
Test Results

Status passed
Test Directory /root is expected to exist
Result
Status passed
Test Directory /home/ec2-user is expected to exist
Result
Result Details

Control V-72015
Title The Red Hat Enterprise Linux operating system must be configured so that all local interactive user home directories are defined in the /etc/passwd file.
Desc If a local interactive user has a home directory defined that does not exist, the user may be given access to the / directory as the current working directory upon logon. This could create a Denial of Service because the user would not be able to access their logon configuration files, and it may give them visibility to system files they normally would not be able to access.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the assigned home directory of all local interactive users on the system exists. Check the home directory assignment for all local interactive non-privileged users on the system with the following command: # cut -d: -f 1,3,6 /etc/passwd | egrep ":[1-4][0-9]{3}" smithj:1001:/home/smithj Note: This may miss interactive users that have been assigned a privileged UID. Evidence of interactive use may be obtained from a number of log files containing system logon information. Check that all referenced home directories exist with the following command: # pwck -r user 'smithj': directory '/home/smithj' does not exist If any home directories referenced in "/etc/passwd" are returned as not defined, this is a finding.
Fix Text Create home directories to all local interactive users that currently do not have a home directory assigned. Use the following commands to create the user home directory assigned in "/etc/ passwd": Note: The example will be for the user smithj, who has a home directory of "/home/smithj", a UID of "smithj", and a Group Identifier (GID) of "users" assigned in "/etc/passwd". # mkdir /home/smithj # chown smithj /home/smithj # chgrp users /home/smithj # chmod 0750 /home/smithj

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72015" do title "The Red Hat Enterprise Linux operating system must be configured so that all local interactive user home directories are defined in the /etc/passwd file." desc "If a local interactive user has a home directory defined that does not exist, the user may be given access to the / directory as the current working directory upon logon. This could create a Denial of Service because the user would not be able to access their logon configuration files, and it may give them visibility to system files they normally would not be able to access." desc "rationale", "" desc "check", " Verify the assigned home directory of all local interactive users on the system exists. Check the home directory assignment for all local interactive non-privileged users on the system with the following command: # cut -d: -f 1,3,6 /etc/passwd | egrep \":[1-4][0-9]{3}\" smithj:1001:/home/smithj Note: This may miss interactive users that have been assigned a privileged UID. Evidence of interactive use may be obtained from a number of log files containing system logon information. Check that all referenced home directories exist with the following command: # pwck -r user 'smithj': directory '/home/smithj' does not exist If any home directories referenced in \"/etc/passwd\" are returned as not defined, this is a finding. " desc "fix", " Create home directories to all local interactive users that currently do not have a home directory assigned. Use the following commands to create the user home directory assigned in \"/etc/ passwd\": Note: The example will be for the user smithj, who has a home directory of \"/home/smithj\", a UID of \"smithj\", and a Group Identifier (GID) of \"users\" assigned in \"/etc/passwd\". # mkdir /home/smithj # chown smithj /home/smithj # chgrp users /home/smithj # chmod 0750 /home/smithj " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72015" tag rid: "SV-86639r2_rule" tag stig_id: "RHEL-07-020620" tag fix_id: "F-78367r2_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] exempt_home_users = input('exempt_home_users') non_interactive_shells = input('non_interactive_shells') ignore_shells = non_interactive_shells.join('|') uid_min = login_defs.read_params['UID_MIN'].to_i uid_min = 1000 if uid_min.nil? users.where{ !shell.match(ignore_shells) && (uid >= uid_min || uid == 0)}.entries.each do |user_info| next if exempt_home_users.include?("#{user_info.username}") describe directory(user_info.home) do it { should exist } end end end
ICMP redirect messages are used by routers to inform hosts that a more direct route exists for a particular destination. These messages contain information from the system's route table, possibly revealing portions of the network topology.
Test Results

Status passed
Test Kernel Parameter net.ipv4.conf.all.send_redirects value is expected to eq 0
Result
Result Details

Control V-72293
Title The Red Hat Enterprise Linux operating system must not send Internet Protocol version 4 (IPv4) Internet Control Message Protocol (ICMP) redirects.
Desc ICMP redirect messages are used by routers to inform hosts that a more direct route exists for a particular destination. These messages contain information from the system's route table, possibly revealing portions of the network topology.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the system does not send IPv4 ICMP redirect messages. # grep 'net.ipv4.conf.all.send_redirects' /etc/sysctl.conf /etc/sysctl.d/* If "net.ipv4.conf.all.send_redirects" is not configured in the /etc/sysctl.conf file or in the /etc/sysctl.d/ directory, is commented out or does not have a value of "0", this is a finding. Check that the operating system implements the "all send_redirects" variables with the following command: # /sbin/sysctl -a | grep 'net.ipv4.conf.all.send_redirects' net.ipv4.conf.all.send_redirects = 0 If the returned line does not have a value of "0", this is a finding.
Fix Text Configure the system to not allow interfaces to perform IPv4 ICMP redirects. Set the system to the required kernel parameter by adding the following line to "/etc/sysctl.conf" or a configuration file in the /etc/sysctl.d/ directory (or modify the line to have the required value): net.ipv4.conf.all.send_redirects = 0 Issue the following command to make the changes take effect: # sysctl --system

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72293" do title "The Red Hat Enterprise Linux operating system must not send Internet Protocol version 4 (IPv4) Internet Control Message Protocol (ICMP) redirects." desc "ICMP redirect messages are used by routers to inform hosts that a more direct route exists for a particular destination. These messages contain information from the system's route table, possibly revealing portions of the network topology." desc "rationale", "" desc "check", " Verify the system does not send IPv4 ICMP redirect messages. # grep 'net.ipv4.conf.all.send_redirects' /etc/sysctl.conf /etc/sysctl.d/* If \"net.ipv4.conf.all.send_redirects\" is not configured in the /etc/sysctl.conf file or in the /etc/sysctl.d/ directory, is commented out or does not have a value of \"0\", this is a finding. Check that the operating system implements the \"all send_redirects\" variables with the following command: # /sbin/sysctl -a | grep 'net.ipv4.conf.all.send_redirects' net.ipv4.conf.all.send_redirects = 0 If the returned line does not have a value of \"0\", this is a finding. " desc "fix", " Configure the system to not allow interfaces to perform IPv4 ICMP redirects. Set the system to the required kernel parameter by adding the following line to \"/etc/sysctl.conf\" or a configuration file in the /etc/sysctl.d/ directory (or modify the line to have the required value): net.ipv4.conf.all.send_redirects = 0 Issue the following command to make the changes take effect: # sysctl --system " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72293" tag rid: "SV-86917r3_rule" tag stig_id: "RHEL-07-040660" tag fix_id: "F-78647r3_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe kernel_parameter('net.ipv4.conf.all.send_redirects') do its('value') { should eq 0 } end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with file == "/usr/sbin/setfiles" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/usr/sbin/setfiles" action is expected not to include "never"
Result
Status passed
Test ["x"] is expected to include "x"
Result
Result Details

Control V-72141
Title The Red Hat Enterprise Linux operating system must audit all uses of the setfiles command.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "setfiles" command occur. Check the file system rule in "/etc/audit/audit.rules" with the following command: # grep -iw /usr/sbin/setfiles /etc/audit/audit.rules -a always,exit -F path=/usr/sbin/setfiles -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change If the command does not return any output, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "setfiles" command occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules": -a always,exit -F path=/usr/sbin/setfiles -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72141" do title "The Red Hat Enterprise Linux operating system must audit all uses of the setfiles command." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"setfiles\" command occur. Check the file system rule in \"/etc/audit/audit.rules\" with the following command: # grep -iw /usr/sbin/setfiles /etc/audit/audit.rules -a always,exit -F path=/usr/sbin/setfiles -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change If the command does not return any output, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"setfiles\" command occur. Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F path=/usr/sbin/setfiles -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000392-GPOS-00172" tag satisfies: ["SRG-OS-000392-GPOS-00172", "SRG-OS-000463-GPOS-00207", "SRG-OS-000465-GPOS-00209"] tag gid: "V-72141" tag rid: "SV-86765r5_rule" tag stig_id: "RHEL-07-030590" tag fix_id: "F-78493r7_fix" tag cci: ["CCI-000172", "CCI-002884"] tag nist: ["AU-12 c", "MA-4 (1) (a)", "Rev_4"] audit_file = '/usr/sbin/setfiles' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'x' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
If the owner of the "cron.allow" file is not set to root, the possibility exists for an unauthorized user to view or to edit sensitive information.
Test Results

Status passed
Test File /etc/cron.allow is expected to be owned by "root"
Result
Result Details

Control V-72053
Title The Red Hat Enterprise Linux operating system must be configured so that the cron.allow file, if it exists, is owned by root.
Desc If the owner of the "cron.allow" file is not set to root, the possibility exists for an unauthorized user to view or to edit sensitive information.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify that the "cron.allow" file is owned by root. Check the owner of the "cron.allow" file with the following command: # ls -al /etc/cron.allow -rw------- 1 root root 6 Mar 5 2011 /etc/cron.allow If the "cron.allow" file exists and has an owner other than root, this is a finding.
Fix Text Set the owner on the "/etc/cron.allow" file to root with the following command: # chown root /etc/cron.allow

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72053" do title "The Red Hat Enterprise Linux operating system must be configured so that the cron.allow file, if it exists, is owned by root." desc "If the owner of the \"cron.allow\" file is not set to root, the possibility exists for an unauthorized user to view or to edit sensitive information." desc "rationale", "" desc "check", " Verify that the \"cron.allow\" file is owned by root. Check the owner of the \"cron.allow\" file with the following command: # ls -al /etc/cron.allow -rw------- 1 root root 6 Mar 5 2011 /etc/cron.allow If the \"cron.allow\" file exists and has an owner other than root, this is a finding. " desc "fix", " Set the owner on the \"/etc/cron.allow\" file to root with the following command: # chown root /etc/cron.allow " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72053" tag rid: "SV-86677r3_rule" tag stig_id: "RHEL-07-021110" tag fix_id: "F-78405r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe.one do # case where file doesn't exist describe file('/etc/cron.allow') do it { should_not exist } end # case where file exists describe file('/etc/cron.allow') do it { should be_owned_by 'root' } end end end
: A session time-out lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not log out because of the temporary nature of the absence. Rather than relying on the user to manually lock their operating system session prior to vacating the vicinity, operating systems need to be able to identify when a user's session has idled and take action to initiate the session lock. The screen and tmux packages allow for a session lock to be implemented and configured.
Test Results

Status passed
Test System Package screen is expected to be installed
Result
Result Details

Control V-71897
Title The Red Hat Enterprise Linux operating system must have the screen package installed.
Desc : A session time-out lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not log out because of the temporary nature of the absence. Rather than relying on the user to manually lock their operating system session prior to vacating the vicinity, operating systems need to be able to identify when a user's session has idled and take action to initiate the session lock. The screen and tmux packages allow for a session lock to be implemented and configured.
Severity medium
Impact 0.5
Nist Controls AC-11 a, Rev_4
Check Text Verify the operating system has the screen package installed. Check to see if the screen package is installed with the following command: # yum list installed screen screen-4.3.1-3-x86_64.rpm If the screen package is not installed, check to see if the tmux package is installed with the following command: #yum list installed tmux tmux-1.8-4.el7.x86_64.rpm If either the screen package or the tmux package is not installed, this is a finding.
Fix Text Install the screen package to allow the initiation of a session lock after a 15-minute period of inactivity. Install the screen program (if it is not on the system) with the following command: # yum install screen OR Install the tmux program (if it is not on the system) with the following command: #yum install tmux

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71897" do title "The Red Hat Enterprise Linux operating system must have the screen package installed." desc ": A session time-out lock is a temporary action taken when a user stops work and moves away from the immediate physical vicinity of the information system but does not log out because of the temporary nature of the absence. Rather than relying on the user to manually lock their operating system session prior to vacating the vicinity, operating systems need to be able to identify when a user's session has idled and take action to initiate the session lock. The screen and tmux packages allow for a session lock to be implemented and configured. " desc "rationale", "" desc "check", " Verify the operating system has the screen package installed. Check to see if the screen package is installed with the following command: # yum list installed screen screen-4.3.1-3-x86_64.rpm If the screen package is not installed, check to see if the tmux package is installed with the following command: #yum list installed tmux tmux-1.8-4.el7.x86_64.rpm If either the screen package or the tmux package is not installed, this is a finding. " desc "fix", " Install the screen package to allow the initiation of a session lock after a 15-minute period of inactivity. Install the screen program (if it is not on the system) with the following command: # yum install screen OR Install the tmux program (if it is not on the system) with the following command: #yum install tmux " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000029-GPOS-00010" tag gid: "V-71897" tag rid: "SV-86521r3_rule" tag stig_id: "RHEL-07-010090" tag fix_id: "F-78249r3_fix" tag cci: ["CCI-000057"] tag nist: ["AC-11 a", "Rev_4"] multiplexer_packages = input('terminal_mux_pkgs') describe.one do multiplexer_packages.each do |pkg| describe package(pkg) do it { should be_installed } end end end end
Open X displays allow an attacker to capture keystrokes and execute commands remotely.
Test Results

Status passed
Test SSHD Configuration X11Forwarding is expected to cmp == "yes"
Result
Result Details

Control V-72303
Title The Red Hat Enterprise Linux operating system must be configured so that remote X connections for interactive users are encrypted.
Desc Open X displays allow an attacker to capture keystrokes and execute commands remotely.
Severity high
Impact 0.7
Nist Controls CM-6 b, Rev_4
Check Text Verify remote X connections for interactive users are encrypted. Check that remote X connections are encrypted with the following command: # grep -i x11forwarding /etc/ssh/sshd_config | grep -v "^#" X11Forwarding yes If the "X11Forwarding" keyword is set to "no" or is missing, this is a finding.
Fix Text Configure SSH to encrypt connections for interactive users. Edit the "/etc/ssh/sshd_config" file to uncomment or add the line for the "X11Forwarding" keyword and set its value to "yes" (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor): X11Forwarding yes The SSH service must be restarted for changes to take effect: # systemctl restart sshd

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72303" do title "The Red Hat Enterprise Linux operating system must be configured so that remote X connections for interactive users are encrypted." desc "Open X displays allow an attacker to capture keystrokes and execute commands remotely." desc "rationale", "" desc "check", " Verify remote X connections for interactive users are encrypted. Check that remote X connections are encrypted with the following command: # grep -i x11forwarding /etc/ssh/sshd_config | grep -v \"^#\" X11Forwarding yes If the \"X11Forwarding\" keyword is set to \"no\" or is missing, this is a finding. " desc "fix", " Configure SSH to encrypt connections for interactive users. Edit the \"/etc/ssh/sshd_config\" file to uncomment or add the line for the \"X11Forwarding\" keyword and set its value to \"yes\" (this file may be named differently or be in a different location if using a version of SSH that is provided by a third-party vendor): X11Forwarding yes The SSH service must be restarted for changes to take effect: # systemctl restart sshd " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72303" tag rid: "SV-86927r4_rule" tag stig_id: "RHEL-07-040710" tag fix_id: "F-78657r6_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe sshd_config do its('X11Forwarding') { should cmp 'yes' } end end
Changes to any software components can have significant effects on the overall security of the operating system. This requirement ensures the software has not been tampered with and that it has been provided by a trusted vendor. Accordingly, patches, service packs, device drivers, or operating system components must be signed with a certificate recognized and approved by the organization. Verifying the authenticity of the software prior to installation validates the integrity of the patch or upgrade received from a vendor. This verifies the software has not been tampered with and that it has been provided by a trusted vendor. Self-signed certificates are disallowed by this requirement. The operating system should not have to verify the software again. This requirement does not mandate DoD certificates for this purpose; however, the certificate used to verify the software must be from an approved CA.
Test Results

Status passed
Test INI /etc/yum.conf main.localpkg_gpgcheck
Result
Result Details

Control V-71979
Title The Red Hat Enterprise Linux operating system must prevent the installation of software, patches, service packs, device drivers, or operating system components of local packages without verification they have been digitally signed using a certificate that is issued by a Certificate Authority (CA) that is recognized and approved by the organization.
Desc Changes to any software components can have significant effects on the overall security of the operating system. This requirement ensures the software has not been tampered with and that it has been provided by a trusted vendor. Accordingly, patches, service packs, device drivers, or operating system components must be signed with a certificate recognized and approved by the organization. Verifying the authenticity of the software prior to installation validates the integrity of the patch or upgrade received from a vendor. This verifies the software has not been tampered with and that it has been provided by a trusted vendor. Self-signed certificates are disallowed by this requirement. The operating system should not have to verify the software again. This requirement does not mandate DoD certificates for this purpose; however, the certificate used to verify the software must be from an approved CA.
Severity high
Impact 0.7
Nist Controls CM-5 (3), Rev_4
Check Text Verify the operating system prevents the installation of patches, service packs, device drivers, or operating system components of local packages without verification that they have been digitally signed using a certificate that is recognized and approved by the organization. Check that yum verifies the signature of local packages prior to install with the following command: # grep localpkg_gpgcheck /etc/yum.conf localpkg_gpgcheck=1 If "localpkg_gpgcheck" is not set to "1", or if options are missing or commented out, ask the System Administrator how the signatures of local packages and other operating system components are verified. If there is no process to validate the signatures of local packages that is approved by the organization, this is a finding.
Fix Text Configure the operating system to verify the signature of local packages prior to install by setting the following option in the "/etc/yum.conf" file: localpkg_gpgcheck=1

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71979" do title "The Red Hat Enterprise Linux operating system must prevent the installation of software, patches, service packs, device drivers, or operating system components of local packages without verification they have been digitally signed using a certificate that is issued by a Certificate Authority (CA) that is recognized and approved by the organization." desc "Changes to any software components can have significant effects on the overall security of the operating system. This requirement ensures the software has not been tampered with and that it has been provided by a trusted vendor. Accordingly, patches, service packs, device drivers, or operating system components must be signed with a certificate recognized and approved by the organization. Verifying the authenticity of the software prior to installation validates the integrity of the patch or upgrade received from a vendor. This verifies the software has not been tampered with and that it has been provided by a trusted vendor. Self-signed certificates are disallowed by this requirement. The operating system should not have to verify the software again. This requirement does not mandate DoD certificates for this purpose; however, the certificate used to verify the software must be from an approved CA. " desc "rationale", "" desc "check", " Verify the operating system prevents the installation of patches, service packs, device drivers, or operating system components of local packages without verification that they have been digitally signed using a certificate that is recognized and approved by the organization. Check that yum verifies the signature of local packages prior to install with the following command: # grep localpkg_gpgcheck /etc/yum.conf localpkg_gpgcheck=1 If \"localpkg_gpgcheck\" is not set to \"1\", or if options are missing or commented out, ask the System Administrator how the signatures of local packages and other operating system components are verified. If there is no process to validate the signatures of local packages that is approved by the organization, this is a finding. " desc "fix", " Configure the operating system to verify the signature of local packages prior to install by setting the following option in the \"/etc/yum.conf\" file: localpkg_gpgcheck=1 " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000366-GPOS-00153" tag gid: "V-71979" tag rid: "SV-86603r2_rule" tag stig_id: "RHEL-07-020060" tag fix_id: "F-78331r1_fix" tag cci: ["CCI-001749"] tag nist: ["CM-5 (3)", "Rev_4"] yum_conf = '/etc/yum.conf' if ((f = file(yum_conf)).exist?) describe ini(yum_conf) do its('main.localpkg_gpgcheck') { cmp 1 } end else describe f do it { should exist } end end end
Preventing non-privileged users from executing privileged functions mitigates the risk that unauthorized individuals or processes may gain unnecessary access to information or privileges. Privileged functions include, for example, establishing accounts, performing system integrity checks, or administering cryptographic key management activities. Non-privileged users are individuals who do not possess appropriate authorizations. Circumventing intrusion detection and prevention mechanisms or malicious code protection mechanisms are examples of privileged functions that require protection from non-privileged users.
Test Results

Status passed
Test Command: `selinuxenabled` exist? is expected to equal true
Result
Status passed
Test Command: `selinuxenabled` exit_status is expected to eq 0
Result
Status passed
Test seusers is expected not to be empty
Result
Status passed
Test SELinux login __default__ is expected to be in "user_u"
Result expected `unconfined_u` to be in the list: `["user_u"]`
Result Details

Control V-71971
Title The Red Hat Enterprise Linux operating system must prevent non-privileged users from executing privileged functions to include disabling, circumventing, or altering implemented security safeguards/countermeasures.
Desc Preventing non-privileged users from executing privileged functions mitigates the risk that unauthorized individuals or processes may gain unnecessary access to information or privileges. Privileged functions include, for example, establishing accounts, performing system integrity checks, or administering cryptographic key management activities. Non-privileged users are individuals who do not possess appropriate authorizations. Circumventing intrusion detection and prevention mechanisms or malicious code protection mechanisms are examples of privileged functions that require protection from non-privileged users.
Severity medium
Impact 0.5
Nist Controls AC-3 (4), AC-6 (10), Rev_4
Check Text If an HBSS or HIPS is active on the system, this is Not Applicable. Verify the operating system prevents non-privileged users from executing privileged functions to include disabling, circumventing, or altering implemented security safeguards/countermeasures. Get a list of authorized users (other than System Administrator and guest accounts) for the system. Check the list against the system by using the following command: # semanage login -l | more Login Name SELinux User MLS/MCS Range Service __default__ user_u s0-s0:c0.c1023 * root unconfined_u s0-s0:c0.c1023 * system_u system_u s0-s0:c0.c1023 * joe staff_u s0-s0:c0.c1023 * All administrators must be mapped to the "sysadm_u" or "staff_u" users role. All authorized non-administrative users must be mapped to the "user_u" role. If they are not mapped in this way, this is a finding.
Fix Text Configure the operating system to prevent non-privileged users from executing privileged functions to include disabling, circumventing, or altering implemented security safeguards/countermeasures. Use the following command to map a new user to the "sysdam_u" role: #semanage login -a -s sysadm_u <username> Use the following command to map an existing user to the "sysdam_u" role: #semanage login -m -s sysadm_u <username> Use the following command to map a new user to the "staff_u" role: #semanage login -a -s staff_u <username> Use the following command to map an existing user to the "staff_u" role: #semanage login -m -s staff_u <username> Use the following command to map a new user to the "user_u" role: # semanage login -a -s user_u <username> Use the following command to map an existing user to the "user_u" role: # semanage login -m -s user_u <username>

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71971" do title "The Red Hat Enterprise Linux operating system must prevent non-privileged users from executing privileged functions to include disabling, circumventing, or altering implemented security safeguards/countermeasures." desc "Preventing non-privileged users from executing privileged functions mitigates the risk that unauthorized individuals or processes may gain unnecessary access to information or privileges. Privileged functions include, for example, establishing accounts, performing system integrity checks, or administering cryptographic key management activities. Non-privileged users are individuals who do not possess appropriate authorizations. Circumventing intrusion detection and prevention mechanisms or malicious code protection mechanisms are examples of privileged functions that require protection from non-privileged users. " desc "rationale", "" desc "check", " If an HBSS or HIPS is active on the system, this is Not Applicable. Verify the operating system prevents non-privileged users from executing privileged functions to include disabling, circumventing, or altering implemented security safeguards/countermeasures. Get a list of authorized users (other than System Administrator and guest accounts) for the system. Check the list against the system by using the following command: # semanage login -l | more Login Name SELinux User MLS/MCS Range Service __default__ user_u s0-s0:c0.c1023 * root unconfined_u s0-s0:c0.c1023 * system_u system_u s0-s0:c0.c1023 * joe staff_u s0-s0:c0.c1023 * All administrators must be mapped to the \"sysadm_u\" or \"staff_u\" users role. All authorized non-administrative users must be mapped to the \"user_u\" role. If they are not mapped in this way, this is a finding. " desc "fix", " Configure the operating system to prevent non-privileged users from executing privileged functions to include disabling, circumventing, or altering implemented security safeguards/countermeasures. Use the following command to map a new user to the \"sysdam_u\" role: #semanage login -a -s sysadm_u <username> Use the following command to map an existing user to the \"sysdam_u\" role: #semanage login -m -s sysadm_u <username> Use the following command to map a new user to the \"staff_u\" role: #semanage login -a -s staff_u <username> Use the following command to map an existing user to the \"staff_u\" role: #semanage login -m -s staff_u <username> Use the following command to map a new user to the \"user_u\" role: # semanage login -a -s user_u <username> Use the following command to map an existing user to the \"user_u\" role: # semanage login -m -s user_u <username> " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000324-GPOS-00125" tag gid: "V-71971" tag rid: "SV-86595r2_rule" tag stig_id: "RHEL-07-020020" tag fix_id: "F-78323r1_fix" tag cci: ["CCI-002165", "CCI-002235"] tag nist: ["AC-3 (4)", "AC-6 (10)", "Rev_4"] admin_logins = input('admin_logins') describe command('selinuxenabled') do its('exist?') { should be true } its('exit_status') { should eq 0 } end # Get the currently enabled selinux mode selinux_mode = file('/etc/selinux/config').content.lines. grep(/\A\s*SELINUXTYPE=/).last.split('=').last.strip # Get the current seusers configuration # # Avoid use of semanage in case it has been uninstalled # # Remove all comments and empty lines seusers = file("/etc/selinux/#{selinux_mode}/seusers").content.lines. grep_v(/(#|\A\s+\Z)/).map(&:strip) # Create collect the remaining results in user/context pairs seusers = seusers.map{|x| x.split(':')[0..1]} describe 'seusers' do it { expect(seusers).to_not be_empty } end users_to_ignore = [ 'root', 'system_u' # This is a default user mapping ] seusers.each do |user, context| next if users_to_ignore.include?(user) describe "SELinux login #{user}" do # This is required by the STIG if user == '__default__' let(:valid_users){[ 'user_u' ]} elsif admin_logins.include?(user) let(:valid_users){[ 'sysadm_u', 'staff_u' ]} else let(:valid_users){[ 'user_u', 'guest_u', 'xguest_u' ]} end it { expect(context).to be_in(valid_users) } end end end
Changes to any software components can have significant effects on the overall security of the operating system. This requirement ensures the software has not been tampered with and that it has been provided by a trusted vendor. Accordingly, patches, service packs, device drivers, or operating system components must be signed with a certificate recognized and approved by the organization. Verifying the authenticity of the software prior to installation validates the integrity of the patch or upgrade received from a vendor. This verifies the software has not been tampered with and that it has been provided by a trusted vendor. Self-signed certificates are disallowed by this requirement. The operating system should not have to verify the software again. This requirement does not mandate DoD certificates for this purpose; however, the certificate used to verify the software must be from an approved CA.
Test Results

Status passed
Test INI /etc/yum.conf main.gpgcheck is expected to cmp == 1
Result
Result Details

Control V-71977
Title The Red Hat Enterprise Linux operating system must prevent the installation of software, patches, service packs, device drivers, or operating system components from a repository without verification they have been digitally signed using a certificate that is issued by a Certificate Authority (CA) that is recognized and approved by the organization.
Desc Changes to any software components can have significant effects on the overall security of the operating system. This requirement ensures the software has not been tampered with and that it has been provided by a trusted vendor. Accordingly, patches, service packs, device drivers, or operating system components must be signed with a certificate recognized and approved by the organization. Verifying the authenticity of the software prior to installation validates the integrity of the patch or upgrade received from a vendor. This verifies the software has not been tampered with and that it has been provided by a trusted vendor. Self-signed certificates are disallowed by this requirement. The operating system should not have to verify the software again. This requirement does not mandate DoD certificates for this purpose; however, the certificate used to verify the software must be from an approved CA.
Severity high
Impact 0.7
Nist Controls CM-5 (3), Rev_4
Check Text Verify the operating system prevents the installation of patches, service packs, device drivers, or operating system components from a repository without verification that they have been digitally signed using a certificate that is recognized and approved by the organization. Check that yum verifies the signature of packages from a repository prior to install with the following command: # grep gpgcheck /etc/yum.conf gpgcheck=1 If "gpgcheck" is not set to "1", or if options are missing or commented out, ask the System Administrator how the certificates for patches and other operating system components are verified. If there is no process to validate certificates that is approved by the organization, this is a finding.
Fix Text Configure the operating system to verify the signature of packages from a repository prior to install by setting the following option in the "/etc/yum.conf" file: gpgcheck=1

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71977" do title "The Red Hat Enterprise Linux operating system must prevent the installation of software, patches, service packs, device drivers, or operating system components from a repository without verification they have been digitally signed using a certificate that is issued by a Certificate Authority (CA) that is recognized and approved by the organization." desc "Changes to any software components can have significant effects on the overall security of the operating system. This requirement ensures the software has not been tampered with and that it has been provided by a trusted vendor. Accordingly, patches, service packs, device drivers, or operating system components must be signed with a certificate recognized and approved by the organization. Verifying the authenticity of the software prior to installation validates the integrity of the patch or upgrade received from a vendor. This verifies the software has not been tampered with and that it has been provided by a trusted vendor. Self-signed certificates are disallowed by this requirement. The operating system should not have to verify the software again. This requirement does not mandate DoD certificates for this purpose; however, the certificate used to verify the software must be from an approved CA. " desc "rationale", "" desc "check", " Verify the operating system prevents the installation of patches, service packs, device drivers, or operating system components from a repository without verification that they have been digitally signed using a certificate that is recognized and approved by the organization. Check that yum verifies the signature of packages from a repository prior to install with the following command: # grep gpgcheck /etc/yum.conf gpgcheck=1 If \"gpgcheck\" is not set to \"1\", or if options are missing or commented out, ask the System Administrator how the certificates for patches and other operating system components are verified. If there is no process to validate certificates that is approved by the organization, this is a finding. " desc "fix", " Configure the operating system to verify the signature of packages from a repository prior to install by setting the following option in the \"/etc/yum.conf\" file: gpgcheck=1 " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000366-GPOS-00153" tag gid: "V-71977" tag rid: "SV-86601r2_rule" tag stig_id: "RHEL-07-020050" tag fix_id: "F-78329r1_fix" tag cci: ["CCI-001749"] tag nist: ["CM-5 (3)", "Rev_4"] yum_conf = '/etc/yum.conf' if ((f = file(yum_conf)).exist?) describe ini(yum_conf) do its('main.gpgcheck') { should cmp 1 } end else describe f do it { should exist } end end end
Firewalls protect computers from network attacks by blocking or limiting access to open network ports. Application firewalls limit which applications are allowed to communicate over the network.
Test Results

Status passed
Test System Package firewalld is expected to be installed
Result
Status passed
Test System Package iptables is expected to be installed
Result
Status passed
Test Service firewalld.service is expected to be running
Result
Result Details

Control V-72273
Title The Red Hat Enterprise Linux operating system must enable an application firewall, if available.
Desc Firewalls protect computers from network attacks by blocking or limiting access to open network ports. Application firewalls limit which applications are allowed to communicate over the network.
Severity medium
Impact 0.5
Nist Controls CM-6 b, Rev_4
Check Text Verify the operating system enabled an application firewall. Check to see if "firewalld" is installed with the following command: # yum list installed firewalld firewalld-0.3.9-11.el7.noarch.rpm If the "firewalld" package is not installed, ask the System Administrator if another firewall application (such as iptables) is installed. If an application firewall is not installed, this is a finding. Check to see if the firewall is loaded and active with the following command: # systemctl status firewalld firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled) Active: active (running) since Tue 2014-06-17 11:14:49 CEST; 5 days ago If "firewalld" does not show a status of "loaded" and "active", this is a finding. Check the state of the firewall: # firewall-cmd --state running If "firewalld" does not show a state of "running", this is a finding.
Fix Text Ensure the operating system's application firewall is enabled. Install the "firewalld" package, if it is not on the system, with the following command: # yum install firewalld Start the firewall via "systemctl" with the following command: # systemctl start firewalld

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72273" do title "The Red Hat Enterprise Linux operating system must enable an application firewall, if available." desc "Firewalls protect computers from network attacks by blocking or limiting access to open network ports. Application firewalls limit which applications are allowed to communicate over the network. " desc "rationale", "" desc "check", " Verify the operating system enabled an application firewall. Check to see if \"firewalld\" is installed with the following command: # yum list installed firewalld firewalld-0.3.9-11.el7.noarch.rpm If the \"firewalld\" package is not installed, ask the System Administrator if another firewall application (such as iptables) is installed. If an application firewall is not installed, this is a finding. Check to see if the firewall is loaded and active with the following command: # systemctl status firewalld firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled) Active: active (running) since Tue 2014-06-17 11:14:49 CEST; 5 days ago If \"firewalld\" does not show a status of \"loaded\" and \"active\", this is a finding. Check the state of the firewall: # firewall-cmd --state running If \"firewalld\" does not show a state of \"running\", this is a finding. " desc "fix", " Ensure the operating system's application firewall is enabled. Install the \"firewalld\" package, if it is not on the system, with the following command: # yum install firewalld Start the firewall via \"systemctl\" with the following command: # systemctl start firewalld " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag satisfies: ["SRG-OS-000480-GPOS-00227", "SRG-OS-000480-GPOS-00231", "SRG-OS-000480-GPOS-00232"] tag gid: "V-72273" tag rid: "SV-86897r2_rule" tag stig_id: "RHEL-07-040520" tag fix_id: "F-78627r1_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe.one do describe package('firewalld') do it { should be_installed } end describe package('iptables') do it { should be_installed } end end describe.one do describe systemd_service('firewalld.service') do it { should be_running } end describe systemd_service('iptables.service') do it { should be_running } end end end
The FTP service provides an unencrypted remote access that does not provide for the confidentiality and integrity of user passwords or the remote session. If a privileged user were to log on using this service, the privileged user password could be compromised. SSH or other encrypted file transfer methods must be used in place of this service.
Test Results

Status passed
Test System Package vsftpd is expected not to be installed
Result
Result Details

Control V-72299
Title The Red Hat Enterprise Linux operating system must not have a File Transfer Protocol (FTP) server package installed unless needed.
Desc The FTP service provides an unencrypted remote access that does not provide for the confidentiality and integrity of user passwords or the remote session. If a privileged user were to log on using this service, the privileged user password could be compromised. SSH or other encrypted file transfer methods must be used in place of this service.
Severity high
Impact 0.7
Nist Controls CM-6 b, Rev_4
Check Text Verify an FTP server has not been installed on the system. Check to see if an FTP server has been installed with the following commands: # yum list installed vsftpd vsftpd-3.0.2.el7.x86_64.rpm If "vsftpd" is installed and is not documented with the Information System Security Officer (ISSO) as an operational requirement, this is a finding.
Fix Text Document the "vsftpd" package with the ISSO as an operational requirement or remove it from the system with the following command: # yum remove vsftpd

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72299" do title "The Red Hat Enterprise Linux operating system must not have a File Transfer Protocol (FTP) server package installed unless needed." desc "The FTP service provides an unencrypted remote access that does not provide for the confidentiality and integrity of user passwords or the remote session. If a privileged user were to log on using this service, the privileged user password could be compromised. SSH or other encrypted file transfer methods must be used in place of this service." desc "rationale", "" desc "check", " Verify an FTP server has not been installed on the system. Check to see if an FTP server has been installed with the following commands: # yum list installed vsftpd vsftpd-3.0.2.el7.x86_64.rpm If \"vsftpd\" is installed and is not documented with the Information System Security Officer (ISSO) as an operational requirement, this is a finding. " desc "fix", " Document the \"vsftpd\" package with the ISSO as an operational requirement or remove it from the system with the following command: # yum remove vsftpd " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72299" tag rid: "SV-86923r3_rule" tag stig_id: "RHEL-07-040690" tag fix_id: "F-78653r3_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe.one do describe package('vsftpd') do it { should_not be_installed } end describe parse_config_file('/etc/vsftpd/vsftpd.conf') do its('ssl_enable') { should cmp 'YES' } its('force_anon_data_ssl') { should cmp 'YES' } its('force_anon_logins_ssl') { should cmp 'YES' } its('force_local_data_ssl') { should cmp 'YES' } its('force_local_logins_ssl') { should cmp 'YES' } end end end
Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged postfix commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Test Results

Status passed
Test Auditd Rules with file == "/usr/sbin/postqueue" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/usr/sbin/postqueue" action is expected not to include "never"
Result
Status passed
Test ["x"] is expected to include "x"
Result
Result Details

Control V-72177
Title The Red Hat Enterprise Linux operating system must audit all uses of the postqueue command.
Desc Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged postfix commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise.
Severity medium
Impact 0.5
Nist Controls AU-3 (1), MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "postqueue" command occur. Check that the following system call is being audited by performing the following command to check the file system rules in "/etc/audit/audit.rules": # grep -iw /usr/sbin/postqueue /etc/audit/audit.rules -a always,exit -F path=/usr/sbin/postqueue -F auid>=1000 -F auid!=4294967295 -k privileged-postfix If the command does not return any output, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "postqueue" command occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules": -a always,exit -F path=/usr/sbin/postqueue -F auid>=1000 -F auid!=4294967295 -k privileged-postfix The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72177" do title "The Red Hat Enterprise Linux operating system must audit all uses of the postqueue command." desc "Reconstruction of harmful events or forensic analysis is not possible if audit records do not contain enough information. At a minimum, the organization must audit the full-text recording of privileged postfix commands. The organization must maintain audit trails in sufficient detail to reconstruct events to determine the cause and impact of compromise. " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"postqueue\" command occur. Check that the following system call is being audited by performing the following command to check the file system rules in \"/etc/audit/audit.rules\": # grep -iw /usr/sbin/postqueue /etc/audit/audit.rules -a always,exit -F path=/usr/sbin/postqueue -F auid>=1000 -F auid!=4294967295 -k privileged-postfix If the command does not return any output, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"postqueue\" command occur. Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F path=/usr/sbin/postqueue -F auid>=1000 -F auid!=4294967295 -k privileged-postfix The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000042-GPOS-00020" tag satisfies: ["SRG-OS-000042-GPOS-00020", "SRG-OS-000392-GPOS-00172"] tag gid: "V-72177" tag rid: "SV-86801r3_rule" tag stig_id: "RHEL-07-030770" tag fix_id: "F-78531r5_fix" tag cci: ["CCI-000135", "CCI-002884"] tag nist: ["AU-3 (1)", "MA-4 (1) (a)", "Rev_4"] audit_file = '/usr/sbin/postqueue' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'x' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
Use of weak or untested encryption algorithms undermines the purposes of using encryption to protect data. The operating system must implement cryptographic modules adhering to the higher standards approved by the federal government since this provides assurance they have been tested and validated.
Test Results

Status passed
Test System Package dracut-fips is expected to be installed
Result
Status passed
Test ro console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 crashkernel=auto is expected to match /\bfips=1\b/
Result expected "ro console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 crashkernel=auto " to match /\bfips=1\b/ Diff: @@ -1,2 +1,2 @@ -/\bfips=1\b/ +"ro console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 crashkernel=auto "
Status passed
Test ro console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 crashkernel=auto is expected to match /\bfips=1\b/
Result expected "ro console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 crashkernel=auto " to match /\bfips=1\b/ Diff: @@ -1,2 +1,2 @@ -/\bfips=1\b/ +"ro console=ttyS0,115200n8 console=tty0 net.ifnames=0 rd.blacklist=nouveau nvme_core.io_timeout=4294967295 crashkernel=auto "
Status passed
Test File /proc/sys/crypto/fips_enabled content.strip is expected to cmp == 1
Result expected: 1 got: 0 (compared using `cmp` matcher)
Result Details

Control V-72067
Title The Red Hat Enterprise Linux operating system must implement NIST FIPS-validated cryptography for the following: to provision digital signatures, to generate cryptographic hashes, and to protect data requiring data-at-rest protections in accordance with applicable federal laws, Executive Orders, directives, policies, regulations, and standards.
Desc Use of weak or untested encryption algorithms undermines the purposes of using encryption to protect data. The operating system must implement cryptographic modules adhering to the higher standards approved by the federal government since this provides assurance they have been tested and validated.
Severity high
Impact 0.7
Nist Controls AC-17 (2), SC-28, SC-13, SC-28 (1), Rev_4
Check Text Verify the operating system implements DoD-approved encryption to protect the confidentiality of remote access sessions. Check to see if the "dracut-fips" package is installed with the following command: # yum list installed dracut-fips dracut-fips-033-360.el7_2.x86_64.rpm If a "dracut-fips" package is installed, check to see if the kernel command line is configured to use FIPS mode with the following command: Note: GRUB 2 reads its configuration from the "/boot/grub2/grub.cfg" file on traditional BIOS-based machines and from the "/boot/efi/EFI/redhat/grub.cfg" file on UEFI machines. # grep fips /boot/grub2/grub.cfg /vmlinuz-3.8.0-0.40.el7.x86_64 root=/dev/mapper/rhel-root ro rd.md=0 rd.dm=0 rd.lvm.lv=rhel/swap crashkernel=auto rd.luks=0 vconsole.keymap=us rd.lvm.lv=rhel/root rhgb fips=1 quiet If the kernel command line is configured to use FIPS mode, check to see if the system is in FIPS mode with the following command: # cat /proc/sys/crypto/fips_enabled 1 If a "dracut-fips" package is not installed, the kernel command line does not have a fips entry, or the system has a value of "0" for "fips_enabled" in "/proc/sys/crypto", this is a finding.
Fix Text Configure the operating system to implement DoD-approved encryption by installing the dracut-fips package. To enable strict FIPS compliance, the fips=1 kernel option needs to be added to the kernel command line during system installation so key generation is done with FIPS-approved algorithms and continuous monitoring tests in place. Configure the operating system to implement DoD-approved encryption by following the steps below: The fips=1 kernel option needs to be added to the kernel command line during system installation so that key generation is done with FIPS-approved algorithms and continuous monitoring tests in place. Users should also ensure that the system has plenty of entropy during the installation process by moving the mouse around, or if no mouse is available, ensuring that many keystrokes are typed. The recommended amount of keystrokes is 256 and more. Less than 256 keystrokes may generate a non-unique key. Install the dracut-fips package with the following command: # yum install dracut-fips Recreate the "initramfs" file with the following command: Note: This command will overwrite the existing "initramfs" file. # dracut -f Modify the kernel command line of the current kernel in the "grub.cfg" file by adding the following option to the GRUB_CMDLINE_LINUX key in the "/etc/default/grub" file and then rebuild the "grub.cfg" file: fips=1 Changes to "/etc/default/grub" require rebuilding the "grub.cfg" file as follows: On BIOS-based machines, use the following command: # grub2-mkconfig -o /boot/grub2/grub.cfg On UEFI-based machines, use the following command: # grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg If /boot or /boot/efi reside on separate partitions, the kernel parameter boot=<partition of /boot or /boot/efi> must be added to the kernel command line. You can identify a partition by running the df /boot or df /boot/efi command: # df /boot Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda1 495844 53780 416464 12% /boot To ensure the "boot=" configuration option will work even if device naming changes occur between boots, identify the universally unique identifier (UUID) of the partition with the following command: # blkid /dev/sda1 /dev/sda1: UUID="05c000f1-a213-759e-c7a2-f11b7424c797" TYPE="ext4" For the example above, append the following string to the kernel command line: boot=UUID=05c000f1-a213-759e-c7a2-f11b7424c797 Reboot the system for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72067" do title "The Red Hat Enterprise Linux operating system must implement NIST FIPS-validated cryptography for the following: to provision digital signatures, to generate cryptographic hashes, and to protect data requiring data-at-rest protections in accordance with applicable federal laws, Executive Orders, directives, policies, regulations, and standards." desc "Use of weak or untested encryption algorithms undermines the purposes of using encryption to protect data. The operating system must implement cryptographic modules adhering to the higher standards approved by the federal government since this provides assurance they have been tested and validated. " desc "rationale", "" desc "check", " Verify the operating system implements DoD-approved encryption to protect the confidentiality of remote access sessions. Check to see if the \"dracut-fips\" package is installed with the following command: # yum list installed dracut-fips dracut-fips-033-360.el7_2.x86_64.rpm If a \"dracut-fips\" package is installed, check to see if the kernel command line is configured to use FIPS mode with the following command: Note: GRUB 2 reads its configuration from the \"/boot/grub2/grub.cfg\" file on traditional BIOS-based machines and from the \"/boot/efi/EFI/redhat/grub.cfg\" file on UEFI machines. # grep fips /boot/grub2/grub.cfg /vmlinuz-3.8.0-0.40.el7.x86_64 root=/dev/mapper/rhel-root ro rd.md=0 rd.dm=0 rd.lvm.lv=rhel/swap crashkernel=auto rd.luks=0 vconsole.keymap=us rd.lvm.lv=rhel/root rhgb fips=1 quiet If the kernel command line is configured to use FIPS mode, check to see if the system is in FIPS mode with the following command: # cat /proc/sys/crypto/fips_enabled 1 If a \"dracut-fips\" package is not installed, the kernel command line does not have a fips entry, or the system has a value of \"0\" for \"fips_enabled\" in \"/proc/sys/crypto\", this is a finding. " desc "fix", " Configure the operating system to implement DoD-approved encryption by installing the dracut-fips package. To enable strict FIPS compliance, the fips=1 kernel option needs to be added to the kernel command line during system installation so key generation is done with FIPS-approved algorithms and continuous monitoring tests in place. Configure the operating system to implement DoD-approved encryption by following the steps below: The fips=1 kernel option needs to be added to the kernel command line during system installation so that key generation is done with FIPS-approved algorithms and continuous monitoring tests in place. Users should also ensure that the system has plenty of entropy during the installation process by moving the mouse around, or if no mouse is available, ensuring that many keystrokes are typed. The recommended amount of keystrokes is 256 and more. Less than 256 keystrokes may generate a non-unique key. Install the dracut-fips package with the following command: # yum install dracut-fips Recreate the \"initramfs\" file with the following command: Note: This command will overwrite the existing \"initramfs\" file. # dracut -f Modify the kernel command line of the current kernel in the \"grub.cfg\" file by adding the following option to the GRUB_CMDLINE_LINUX key in the \"/etc/default/grub\" file and then rebuild the \"grub.cfg\" file: fips=1 Changes to \"/etc/default/grub\" require rebuilding the \"grub.cfg\" file as follows: On BIOS-based machines, use the following command: # grub2-mkconfig -o /boot/grub2/grub.cfg On UEFI-based machines, use the following command: # grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg If /boot or /boot/efi reside on separate partitions, the kernel parameter boot=<partition of /boot or /boot/efi> must be added to the kernel command line. You can identify a partition by running the df /boot or df /boot/efi command: # df /boot Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda1 495844 53780 416464 12% /boot To ensure the \"boot=\" configuration option will work even if device naming changes occur between boots, identify the universally unique identifier (UUID) of the partition with the following command: # blkid /dev/sda1 /dev/sda1: UUID=\"05c000f1-a213-759e-c7a2-f11b7424c797\" TYPE=\"ext4\" For the example above, append the following string to the kernel command line: boot=UUID=05c000f1-a213-759e-c7a2-f11b7424c797 Reboot the system for the changes to take effect. " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000033-GPOS-00014" tag satisfies: ["SRG-OS-000033-GPOS-00014", "SRG-OS-000185-GPOS-00079", "SRG-OS-000396-GPOS-00176", "SRG-OS-000405-GPOS-00184", "SRG-OS-000478-GPOS-00223"] tag gid: "V-72067" tag rid: "SV-86691r4_rule" tag stig_id: "RHEL-07-021350" tag fix_id: "F-78419r3_fix" tag cci: ["CCI-000068", "CCI-001199", "CCI-002450", "CCI-002476"] tag nist: ["AC-17 (2)", "SC-28", "SC-13", "SC-28 (1)", "Rev_4"] describe package('dracut-fips') do it { should be_installed } end all_args = command('grubby --info=ALL | grep "^args=" | sed "s/^args=//g"'). stdout.strip.split("\n"). map { |s| s.sub(%r{^"(.*)"$}, '\1') } # strip outer quotes if they exist all_args.each { |args| describe args do it { should match %r{\bfips=1\b} } end } describe file('/proc/sys/crypto/fips_enabled') do its('content.strip') { should cmp 1 } end end
Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Test Results

Status passed
Test Auditd Rules with file == "/usr/bin/chcon" permissions is expected not to cmp == []
Result
Status passed
Test Auditd Rules with file == "/usr/bin/chcon" action is expected not to include "never"
Result
Status passed
Test ["x"] is expected to include "x"
Result
Result Details

Control V-72139
Title The Red Hat Enterprise Linux operating system must audit all uses of the chcon command.
Desc Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter).
Severity medium
Impact 0.5
Nist Controls AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "chcon" command occur. Check the file system rule in "/etc/audit/audit.rules" with the following command: # grep -i /usr/bin/chcon /etc/audit/audit.rules -a always,exit -F path=/usr/bin/chcon -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change If the command does not return any output, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "chcon" command occur. Add or update the following rule in "/etc/audit/rules.d/audit.rules": -a always,exit -F path=/usr/bin/chcon -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72139" do title "The Red Hat Enterprise Linux operating system must audit all uses of the chcon command." desc "Without generating audit records that are specific to the security and mission needs of the organization, it would be difficult to establish, correlate, and investigate the events relating to an incident or identify those responsible for one. Audit records can be generated from various components within the information system (e.g., module or policy filter). " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"chcon\" command occur. Check the file system rule in \"/etc/audit/audit.rules\" with the following command: # grep -i /usr/bin/chcon /etc/audit/audit.rules -a always,exit -F path=/usr/bin/chcon -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change If the command does not return any output, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"chcon\" command occur. Add or update the following rule in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F path=/usr/bin/chcon -F auid>=1000 -F auid!=4294967295 -k privileged-priv_change The audit daemon must be restarted for the changes to take effect. " tag severity: nil tag gtitle: "SRG-OS-000392-GPOS-00172" tag satisfies: ["SRG-OS-000392-GPOS-00172", "SRG-OS-000463-GPOS-00207", "SRG-OS-000465-GPOS-00209"] tag gid: "V-72139" tag rid: "SV-86763r4_rule" tag stig_id: "RHEL-07-030580" tag fix_id: "F-78491r6_fix" tag cci: ["CCI-000172", "CCI-002884"] tag nist: ["AU-12 c", "MA-4 (1) (a)", "Rev_4"] audit_file = '/usr/bin/chcon' if file(audit_file).exist? impact 0.5 else impact 0.0 end describe auditd.file(audit_file) do its('permissions') { should_not cmp [] } its('action') { should_not include 'never' } end if file(audit_file).exist? # Resource creates data structure including all usages of file perms = auditd.file(audit_file).permissions perms.each do |perm| describe perm do it { should include 'x' } end end if file(audit_file).exist? describe "The #{audit_file} file does not exist" do skip "The #{audit_file} file does not exist, this requirement is Not Applicable." end if !file(audit_file).exist? end
Providing users with feedback on when account accesses last occurred facilitates user recognition and reporting of unauthorized account use.
Test Results

Status passed
Test PAM Config[/etc/pam.d/postlogin] lines is expected to include session .* pam_lastlog.so showfailed
Result
Status passed
Test SSHD Configuration PrintLastLog is expected to cmp == "yes"
Result
Result Details

Control V-72275
Title The Red Hat Enterprise Linux operating system must display the date and time of the last successful account logon upon logon.
Desc Providing users with feedback on when account accesses last occurred facilitates user recognition and reporting of unauthorized account use.
Severity low
Impact 0.3
Nist Controls CM-6 b, Rev_4
Check Text Verify users are provided with feedback on when account accesses last occurred. Check that "pam_lastlog" is used and not silent with the following command: # grep pam_lastlog /etc/pam.d/postlogin session required pam_lastlog.so showfailed If "pam_lastlog" is missing from "/etc/pam.d/postlogin" file, or the silent option is present, this is a finding.
Fix Text Configure the operating system to provide users with feedback on when account accesses last occurred by setting the required configuration options in "/etc/pam.d/postlogin". Add the following line to the top of "/etc/pam.d/postlogin": session required pam_lastlog.so showfailed

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72275" do title "The Red Hat Enterprise Linux operating system must display the date and time of the last successful account logon upon logon." desc "Providing users with feedback on when account accesses last occurred facilitates user recognition and reporting of unauthorized account use." desc "rationale", "" desc "check", " Verify users are provided with feedback on when account accesses last occurred. Check that \"pam_lastlog\" is used and not silent with the following command: # grep pam_lastlog /etc/pam.d/postlogin session required pam_lastlog.so showfailed If \"pam_lastlog\" is missing from \"/etc/pam.d/postlogin\" file, or the silent option is present, this is a finding. " desc "fix", " Configure the operating system to provide users with feedback on when account accesses last occurred by setting the required configuration options in \"/etc/pam.d/postlogin\". Add the following line to the top of \"/etc/pam.d/postlogin\": session required pam_lastlog.so showfailed " impact 0.3 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72275" tag rid: "SV-86899r4_rule" tag stig_id: "RHEL-07-040530" tag fix_id: "F-78629r4_fix" tag cci: ["CCI-000366"] tag nist: ["CM-6 b", "Rev_4"] describe pam('/etc/pam.d/postlogin') do its('lines') { should match_pam_rule('session .* pam_lastlog.so showfailed') } end describe.one do describe sshd_config do its('PrintLastLog') { should cmp 'yes' } end describe pam('/etc/pam.d/postlogin') do its('lines') { should match_pam_rule('session .* pam_lastlog.so showfailed').all_without_args('silent') } end end end
Configuring this setting for the SSH daemon provides additional assurance that remote logon via SSH will require a password, even in the event of misconfiguration elsewhere.
Test Results

Status passed
Test SSHD Configuration PermitEmptyPasswords is expected to eq "no"
Result
Result Details

Control V-71939
Title The Red Hat Enterprise Linux operating system must be configured so that the SSH daemon does not allow authentication using an empty password.
Desc Configuring this setting for the SSH daemon provides additional assurance that remote logon via SSH will require a password, even in the event of misconfiguration elsewhere.
Severity high
Impact 0.7
Nist Controls IA-2 (2), Rev_4
Check Text To determine how the SSH daemon's "PermitEmptyPasswords" option is set, run the following command: # grep -i PermitEmptyPasswords /etc/ssh/sshd_config PermitEmptyPasswords no If no line, a commented line, or a line indicating the value "no" is returned, the required value is set. If the required value is not set, this is a finding.
Fix Text To explicitly disallow remote logon from accounts with empty passwords, add or correct the following line in "/etc/ssh/sshd_config": PermitEmptyPasswords no The SSH service must be restarted for changes to take effect. Any accounts with empty passwords should be disabled immediately, and PAM configuration should prevent users from being able to assign themselves empty passwords.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-71939" do title "The Red Hat Enterprise Linux operating system must be configured so that the SSH daemon does not allow authentication using an empty password." desc "Configuring this setting for the SSH daemon provides additional assurance that remote logon via SSH will require a password, even in the event of misconfiguration elsewhere." desc "rationale", "" desc "check", " To determine how the SSH daemon's \"PermitEmptyPasswords\" option is set, run the following command: # grep -i PermitEmptyPasswords /etc/ssh/sshd_config PermitEmptyPasswords no If no line, a commented line, or a line indicating the value \"no\" is returned, the required value is set. If the required value is not set, this is a finding. " desc "fix", " To explicitly disallow remote logon from accounts with empty passwords, add or correct the following line in \"/etc/ssh/sshd_config\": PermitEmptyPasswords no The SSH service must be restarted for changes to take effect. Any accounts with empty passwords should be disabled immediately, and PAM configuration should prevent users from being able to assign themselves empty passwords. " impact 0.7 tag severity: nil tag gtitle: "SRG-OS-000106-GPOS-00053" tag gid: "V-71939" tag rid: "SV-86563r3_rule" tag stig_id: "RHEL-07-010300" tag fix_id: "F-78291r2_fix" tag cci: ["CCI-000766"] tag nist: ["IA-2 (2)", "Rev_4"] describe sshd_config do its('PermitEmptyPasswords') { should eq 'no' } end end
Unowned files and directories may be unintentionally inherited if a user is assigned the same User Identifier "UID" as the UID of the un-owned files.
Test Results

Status passed
Test Command: `find / -xautofs -fstype xfs -nouser` stdout.strip is expected to be empty
Result
Status passed
Test Command: `find / -xautofs -fstype ext3 -nouser` stdout.strip is expected to be empty
Result
Status passed
Test Command: `find / -xautofs -fstype ext2 -nouser` stdout.strip is expected to be empty
Result
Status passed
Test Command: `find / -xautofs -fstype ext4 -nouser` stdout.strip is expected to be empty
Result
Status passed
Test Command: `find / -xautofs -fstype msdos -nouser` stdout.strip is expected to be empty
Result
Status passed
Test Command: `find / -xautofs -fstype vfat -nouser` stdout.strip is expected to be empty
Result
Status passed
Test Command: `find / -xautofs -fstype btrfs -nouser` stdout.strip is expected to be empty
Result
Status passed
Test Command: `find / -xautofs -fstype fuseblk -nouser` stdout.strip is expected to be empty
Result
Result Details

Control V-72007
Title The Red Hat Enterprise Linux operating system must be configured so that all files and directories have a valid owner.
Desc Unowned files and directories may be unintentionally inherited if a user is assigned the same User Identifier "UID" as the UID of the un-owned files.
Severity medium
Impact 0.5
Nist Controls AC-3 (4), Rev_4
Check Text Verify all files and directories on the system have a valid owner. Check the owner of all files and directories with the following command: Note: The value after -fstype must be replaced with the filesystem type. XFS is used as an example. # find / -fstype xfs -nouser If any files on the system do not have an assigned owner, this is a finding.
Fix Text Either remove all files and directories from the system that do not have a valid user, or assign a valid user to all unowned files and directories on the system with the "chown" command: # chown <user> <file>

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72007" do title "The Red Hat Enterprise Linux operating system must be configured so that all files and directories have a valid owner." desc "Unowned files and directories may be unintentionally inherited if a user is assigned the same User Identifier \"UID\" as the UID of the un-owned files." desc "rationale", "" desc "check", " Verify all files and directories on the system have a valid owner. Check the owner of all files and directories with the following command: Note: The value after -fstype must be replaced with the filesystem type. XFS is used as an example. # find / -fstype xfs -nouser If any files on the system do not have an assigned owner, this is a finding. " desc "fix", " Either remove all files and directories from the system that do not have a valid user, or assign a valid user to all unowned files and directories on the system with the \"chown\" command: # chown <user> <file> " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72007" tag rid: "SV-86631r3_rule" tag stig_id: "RHEL-07-020320" tag fix_id: "F-78359r1_fix" tag cci: ["CCI-002165"] tag nist: ["AC-3 (4)", "Rev_4"] command('grep -v "nodev" /proc/filesystems | awk \'NF{ print $NF }\''). stdout.strip.split("\n").each do |fs| describe command("find / -xautofs -fstype #{fs} -nouser") do its('stdout.strip') { should be_empty } end end end
If the system is not configured to audit certain activities and write them to an audit log, it is more difficult to detect and track system compromises and damages incurred during a system compromise.
Test Results

Status passed
Test Auditd Rules with syscall == "rmdir" arch == "b32" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "rmdir" arch == "b32" list.uniq is expected to eq ["exit"]
Result
Status passed
Test Auditd Rules with syscall == "rmdir" arch == "b64" action.uniq is expected to eq ["always"]
Result
Status passed
Test Auditd Rules with syscall == "rmdir" arch == "b64" list.uniq is expected to eq ["exit"]
Result
Result Details

Control V-72203
Title The Red Hat Enterprise Linux operating system must audit all uses of the rmdir syscall.
Desc If the system is not configured to audit certain activities and write them to an audit log, it is more difficult to detect and track system compromises and damages incurred during a system compromise.
Severity medium
Impact 0.5
Nist Controls AU-12 c, MA-4 (1) (a), Rev_4
Check Text Verify the operating system generates audit records when successful/unsuccessful attempts to use the "rmdir" syscall occur. Check the file system rules in "/etc/audit/audit.rules" with the following commands: # grep -iw rmdir /etc/audit/audit.rules -a always,exit -F arch=b32 -S rmdir -F auid>=1000 -F auid!=4294967295 -k delete -a always,exit -F arch=b64 -S rmdir -F auid>=1000 -F auid!=4294967295 -k delete If both the "b32" and "b64" audit rules are not defined for the "rmdir" syscall, this is a finding.
Fix Text Configure the operating system to generate audit records when successful/unsuccessful attempts to use the "rmdir" syscall occur. Add the following rules in "/etc/audit/rules.d/audit.rules": -a always,exit -F arch=b32 -S rmdir -F auid>=1000 -F auid!=4294967295 -k delete -a always,exit -F arch=b64 -S rmdir -F auid>=1000 -F auid!=4294967295 -k delete The audit daemon must be restarted for the changes to take effect.

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72203" do title "The Red Hat Enterprise Linux operating system must audit all uses of the rmdir syscall." desc "If the system is not configured to audit certain activities and write them to an audit log, it is more difficult to detect and track system compromises and damages incurred during a system compromise. " desc "rationale", "" desc "check", " Verify the operating system generates audit records when successful/unsuccessful attempts to use the \"rmdir\" syscall occur. Check the file system rules in \"/etc/audit/audit.rules\" with the following commands: # grep -iw rmdir /etc/audit/audit.rules -a always,exit -F arch=b32 -S rmdir -F auid>=1000 -F auid!=4294967295 -k delete -a always,exit -F arch=b64 -S rmdir -F auid>=1000 -F auid!=4294967295 -k delete If both the \"b32\" and \"b64\" audit rules are not defined for the \"rmdir\" syscall, this is a finding. " desc "fix", " Configure the operating system to generate audit records when successful/unsuccessful attempts to use the \"rmdir\" syscall occur. Add the following rules in \"/etc/audit/rules.d/audit.rules\": -a always,exit -F arch=b32 -S rmdir -F auid>=1000 -F auid!=4294967295 -k delete -a always,exit -F arch=b64 -S rmdir -F auid>=1000 -F auid!=4294967295 -k delete The audit daemon must be restarted for the changes to take effect. " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000466-GPOS-00210" tag satisfies: ["SRG-OS-000466-GPOS-00210", "SRG-OS-000467-GPOS-00210", "SRG-OS-000468-GPOS-00212", "SRG-OS-000392-GPOS-00172"] tag gid: "V-72203" tag rid: "SV-86827r5_rule" tag stig_id: "RHEL-07-030900" tag fix_id: "F-78557r9_fix" tag cci: ["CCI-000172", "CCI-002884"] tag nist: ["AU-12 c", "MA-4 (1) (a)", "Rev_4"] describe auditd.syscall("rmdir").where {arch == "b32"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end if os.arch == 'x86_64' describe auditd.syscall("rmdir").where {arch == "b64"} do its('action.uniq') { should eq ['always'] } its('list.uniq') { should eq ['exit'] } end end end
If an unauthorized or modified device is allowed to exist on the system, there is the possibility the system may perform unintended or unauthorized operations.
Test Results

Status passed
Test #<Set: {}> length is expected to cmp == 0
Result
Result Details

Control V-72039
Title The Red Hat Enterprise Linux operating system must be configured so that all system device files are correctly labeled to prevent unauthorized modification.
Desc If an unauthorized or modified device is allowed to exist on the system, there is the possibility the system may perform unintended or unauthorized operations.
Severity medium
Impact 0.5
Nist Controls CM-3 f, CM-6 c, CM-11 (2), CM-5 (1), CM-5 (1), Rev_4
Check Text Verify that all system device files are correctly labeled to prevent unauthorized modification. List all device files on the system that are incorrectly labeled with the following commands: Note: Device files are normally found under "/dev", but applications may place device files in other directories and may necessitate a search of the entire system. #find /dev -context *:device_t:* \( -type c -o -type b \) -printf "%p %Z " #find /dev -context *:unlabeled_t:* \( -type c -o -type b \) -printf "%p %Z " Note: There are device files, such as "/dev/vmci", that are used when the operating system is a host virtual machine. They will not be owned by a user on the system and require the "device_t" label to operate. These device files are not a finding. If there is output from either of these commands, other than already noted, this is a finding.
Fix Text Run the following command to determine which package owns the device file: # rpm -qf <filename> The package can be reinstalled from a yum repository using the command: # sudo yum reinstall <packagename> Alternatively, the package can be reinstalled from trusted media using the command: # sudo rpm -Uvh <packagename>

========================================================= # Profile name: Red Hat Enterprise Linux 7 STIG ========================================================= control "V-72039" do title "The Red Hat Enterprise Linux operating system must be configured so that all system device files are correctly labeled to prevent unauthorized modification." desc "If an unauthorized or modified device is allowed to exist on the system, there is the possibility the system may perform unintended or unauthorized operations." desc "rationale", "" desc "check", " Verify that all system device files are correctly labeled to prevent unauthorized modification. List all device files on the system that are incorrectly labeled with the following commands: Note: Device files are normally found under \"/dev\", but applications may place device files in other directories and may necessitate a search of the entire system. #find /dev -context *:device_t:* \\( -type c -o -type b \\) -printf \"%p %Z\ \" #find /dev -context *:unlabeled_t:* \\( -type c -o -type b \\) -printf \"%p %Z\ \" Note: There are device files, such as \"/dev/vmci\", that are used when the operating system is a host virtual machine. They will not be owned by a user on the system and require the \"device_t\" label to operate. These device files are not a finding. If there is output from either of these commands, other than already noted, this is a finding. " desc "fix", " Run the following command to determine which package owns the device file: # rpm -qf <filename> The package can be reinstalled from a yum repository using the command: # sudo yum reinstall <packagename> Alternatively, the package can be reinstalled from trusted media using the command: # sudo rpm -Uvh <packagename> " impact 0.5 tag severity: nil tag gtitle: "SRG-OS-000480-GPOS-00227" tag gid: "V-72039" tag rid: "SV-86663r2_rule" tag stig_id: "RHEL-07-020900" tag fix_id: "F-78391r1_fix" tag cci: ["CCI-000318", "CCI-000368", "CCI-001812", "CCI-001813", "CCI-001814"] tag nist: ["CM-3 f", "CM-6 c", "CM-11 (2)", "CM-5 (1)", "CM-5 (1)", "Rev_4"] virtual_machine = input('virtual_machine') findings = Set[] findings = findings + command('find / -context *:device_t:* \( -type c -o -type b \) -printf "%p %Z\n"').stdout.split("\n") findings = findings + command('find / -context *:unlabeled_t:* \( -type c -o -type b \) -printf "%p %Z\n"').stdout.split("\n") findings = findings + command('find / -context *:vmci_device_t:* \( -type c -o -type b \) -printf "%p %Z\n"').stdout.split("\n") describe findings do if virtual_machine its ('length') { should cmp 1 } its ('first') { should include '/dev/vmci' } else its ('length') { should cmp 0 } end end end